-
- Function |
- Description |
-
-
- "$ABOVE()" |
- The address range of cells above the current cell |
-
-
- "$AVERAGE(list)" |
- The average of the content of a range of cells. Example: To get the average of column 5 excluding the title row, write in the last row: %CALC{"$AVERAGE( R2:C5..R$ROW(-1):C5 )"}% |
-
-
- "$CHAR(number)" |
- The ASCII character represented by number. Example: %CALC{"$CHAR(97)"}% returns a |
-
-
- "$CODE(text)" |
- The ASCII numeric value of the first character in text. Example: %CALC{"$CODE(abc)"}% returns 97 |
-
-
- "$COLUMN(offset)" |
- The current column number with an optional offset |
-
-
- "$COUNTITEMS(list)" |
- The count of individual items in a list. Example: To count the items of all cells above the current cell, write %CALC{"$COUNTITEMS( $ABOVE() )"}% |
-
-
- "$COUNTSTR(list, str)" |
- Counts the number of cells in a list equal to a given string (if str is specified), or counts the number of non empty cells in a list. Example: To count the number of non empty cells above the current cell, write %CALC{"$COUNTSTR( $ABOVE() )"}% ; to count the number of cells equal to DONE , write %CALC{"$COUNTSTR( $ABOVE(), DONE )"}% ; |
-
-
- "$DEF(list)" |
- Returns the first list item or cell reference that is not empty. Example: %CALC{"$DEF( R1:C1..R1:C3 )"}% |
-
-
- "$EVAL(formula)" |
- Evaluates a simple formula. Only addition, substraction, multiplication, division and modulus of numbers are supported. Any nesting is permitted. Example: %CALC{"$EVAL( (5 * 3) / 2 + 1.1 )"}% returns 8.6 |
-
-
- "$EXACT(text1, text2)" |
- Compares two text strings and returns 1 if they are exactly the same, or 0 if not. Example: %CALC{"$EXACT( foo, Foo )"}% returns 0 ; %CALC{"$EXACT( foo, $LOWER(Foo) )"}% returns 1 |
-
-
- "$FIND(search_string, text, start_index)" |
- Finds one text string search_string , within another text string text , and returns the number of the starting position of search_string , from the first character of text . This search is case sensitive and is not a regular expression search; use $SEARCH() for regular expression searching. Starting position is 1; an empty string is returned if nothing is matched. Examples: %BR% %CALC{"$FIND(f, fluffy)"}% returns 1 %BR% %CALC{"$FIND(f, fluffy, 2)"}% returns 4 %BR% %CALC{"$FIND(@, fluffy, 1)"}% returns an empty string |
-
-
- "$FORMAT(type, prec, number)" |
- Formats a number to a certain type and precision. Types with examples: Â - %CALC{"$FORMAT( COMMA, 2, 12345.6789 )"}% returns 12,345.68 Â - %CALC{"$FORMAT( DOLLAR, 2, 12345.67 )"}% returns $12,345.68 Â - %CALC{"$FORMAT( NUMBER, 1, 12345.67 )"}% returns 12345.7 Â - %CALC{"$FORMAT( PERCENT, 1, 0.1234567 )"}% returns 12.3% |
-
-
- "$FORMATTIME( serial, text )" |
- Convert a serialized date into a date string; the following variables in text are expanded: $second (seconds, 00..59); $minute (minutes, 00..59); $hour (hours, 00..23); $day (day of month, 01..31); $month (month, 01..12); $mon (month in text format, Jan..Dec); $year (4 digit year, 1999); $ye (2 digit year, 99), $wd (day number of the week, 1 for Sunday, 2 for Monday, etc), $wday (day of the week, Sun..Sat), $weekday (day of the week, Sunday..Saturday), $yearday (day of the year, 1..365, or 1..366 in leap years). Date is assumed to be server time; add GMT to indicate Greenwich time zone. See also $TIME() , $TODAY() , $FORMATGMTIME() , $TIMEDIFF() . Example: %CALC{"$FORMATTIME( 0, $year/$month/$day GMT )"}% returns 1970/01/01 GMT |
-
-
- "$FORMATGMTIME( serial, text )" |
- Convert a serialized date into a date string in Greenwich time zone. Same variables expansion as in $FORMATTIME() . Example: %CALC{"$FORMATGMTIME( 1041379200, $day $mon $year )"}% returns 01 Jan 2003 |
-
-
- "$GET(name)" |
- Get the value of a previously set variable. Specify the variable name (alphanumeric characters and underscores). An empty string is returned if the variable does not exist. Use $SET() to set a variable first. Unlike table ranges, variables live for the time of the page view and persist across tables, i.e. you can use it to summarize results across several tables. See also $SET() . Example: %CALC{"$GET( my_total )"}% returns the value of the my_total variable |
-
-
- "$IF(condition, value if true, value if 0)" |
- Returns one value if a condition is met, and another value if not. The condition can be a number (where 0 means condition not met), or two numbers with a comparison operator < (less then), <= (less then or equal), == (equal), != (not equal), >= (greater then or equal), >= (greater then). Example: %CALC{"$IF( $T(R1:C5) > 1000, Over Budget, OK )"}% returns Over Budget if value in R1:C5 is over 1000, OK if not |
-
-
- "$INT(formula)" |
- Evaluates a simple formula and rounds the result down to the nearest integer. Example: %CALC{"$INT( 10 / 4 )"}% returns 2 |
-
-
- "$LEFT()" |
- The address range of cells to the left of the current cell |
-
-
- "$LENGTH(text)" |
- The length in bytes of text. Example: %CALC{"$LENGTH(abcd)"}% returns 4 |
-
-
- "$LOWER(text)" |
- The lower case string of a text. Example: %CALC{"$LOWER( $T(R1:C5) )"}% returns the lower case string of the text in cell R1:C5 |
-
-
- "$MAX(list)" |
- The biggest value of a list or range of cells. Example: To find the biggest number to the left of the current cell, write: %CALC{"$MAX( $LEFT() )"}% |
-
-
- "$MEDIAN(list)" |
- The median of a list or range of cells. Example: %CALC{"$MEDIAN( 3, 9, 4, 5 )"}% returns 4.5 |
-
-
- "$MIN(list)" |
- The smallest value of a list or range of cells. Example: %CALC{"$MIN( 15, 3, 28 )"}% returns 3 |
-
-
- "$MULT(list)" |
- The product of a list or range of cells. Example: to calculate the product of the cells to the left of the current one use %CALC{"$MULT($LEFT())"}% |
-
-
- "$NOP(text)" |
- A no-operation. Allows one to defy the order of Plugin execution. For example, it will allow preprossing to be done before %SEARCH{}% is evaluated. Use $per to escape '%'. |
-
-
- "$REPLACE(text, start_num, num_chars, new_text)" |
- Replaces part of text string text , based on the starting position start_num , and the number of characters to replace num_chars . The characters are replaced with new_text . Starting position is 1; use a negative start_num to count from the end of the text. See also $SUBSTITUTE() , $TRANSLATE() . Example: %BR% %CALC{"$REPLACE(abcdefghijk,6,5,*)"}% returns abcde*k |
-
-
- "$RIGHT()" |
- The address range of cells to the right of the current cell |
-
-
- "$ROUND(formula)" |
- Evaluates a simple formula and rounds the result up or down to the nearest integer. Example: %CALC{"$INT( 10 / 6 )"}% returns 2 |
-
-
- "$ROW(offset)" |
- The current row number with an offset. Example: To get the number of rows excluding table heading ( first row) and summary row (last row you are in), write: %CALC{"$ROW(-2)"}% |
-
-
- "$SEARCH(search_string, text, start_index)" |
- Finds one text string search_string , within another text string text , and returns the number of the starting position of search_string , from the first character of text . This search a [[TWiki/RegularExpression]] search; use $FIND() for non-regular expression searching. Starting position is 1; an empty string is returned if nothing is matched. Examples: %BR% %CALC{"$SEARCH([uy], fluffy)"}% returns 3 %BR% %CALC{"$SEARCH([uy], fluffy, 3)"}% returns 6 %BR% %CALC{"$SEARCH([abc], fluffy,)"}% returns an empty string |
-
-
- "$SET(name, value)" |
- Set a variable for later use. Specify the variable name (alphanumeric characters and underscores) and the value. The value may contain a formula; formulas are evaluated before the variable assignment. This function returns no output. Use $GET() to retrieve variables. Unlike table ranges, variables live for the time of the page view and persist across tables, i.e. you can use it to summarize results across several tables. See also $GET() . Example: %CALC{"$SET( my_total, $SUM($ABOVE()) )"}% sets the my_total variable to the sum of all table cells located above the current cell and returns an empty string |
-
-
- "$SUBSTITUTE(text, old, new, instance, option)" |
- Substitutes new text for old text in a text string. instance specifies which occurance of old you want to replace. If you specify instance , only that instance is replaced. Otherwise, every occurance is changed to the new text. A literal search is performed by default; a [[TWiki/RegularExpression]] search if the option is set to r . See also $REPLACE() , $TRANSLATE() . Examples: %BR% %CALC{"$SUBSTITUTE(Good morning, morning, day)"}% returns Good day %BR% %CALC{"$SUBSTITUTE(Q2-2002,2,3)"}% returns Q3-3003 %BR% %CALC{"$SUBSTITUTE(Q2-2002,2,3,3)"}% returns Q2-2003 %BR% %CALC{"$SUBSTITUTE(abc123def,[0-9],9,,r)"}% returns abc999def |
-
-
- "$SUM(list)" |
- The sum of a list or range of cells. Example: To sum up column 5 excluding the title row, write: %CALC{"$SUM( R2:C5..R$ROW(-1):C5 )"}% in the last row; or simply %CALC{"$SUM( $ABOVE() )"}% |
-
-
- "$SUMDAYS(list)" |
- The total number of days in a list or range of cells containing numbers of hours, days or weeks. The default unit is days; units are indicated by a h , hours , d , days , w , weeks suffix. One week is assumed to have 5 working days, one day 8 hours. Example: %CALC{"$SUMDAYS( 2w, 1, 2d, 4h )"}% returns 13.5 , the evaluation of (2*5 + 1 + 2 + 4/8) |
-
-
- "$SUMPRODUCT(list, list, ...)" |
- The scalar product on ranges of cells. Example: %CALC{"$SUM( R2:C1..R4:C1, R2:C5..R4:C5 )"}% evaluates and returns ($T(R2:C1) * $T(R2:C5) + $T(R3:C1) * $T(R3:C5) + $T(R4:C1) * $T(R4:C5)) |
-
-
- "$T(address)" |
- The content of a cell. Example: %CALC{"$T(R1:C5)"}% returns the text in cell R1:C5 |
-
-
- "$TRANSLATE(text, from, to)" |
- Translate text from a set of characters to another set, one character by one. The text may contain commas; the last two comma separated parameters are required. For from and to parameters, you can write $comma to escape comma, $sp to escape space. See also $REPLACE() , $SUBSTITUTE() . Examples: %BR% %CALC{"$TRANSLATE(boom,bm,cl)"}% returns cool %BR% %CALC{"$TRANSLATE(one, two,$comma,;)"}% returns one; two |
-
-
- "$TIME(text)" |
- Converts a date string into a serialized date number (seconds since the Epoch, e.g. midnight, 01 Jan 1970). Current time is taken if the date string is empty. Supported date formats: 31 Dec 2009 ; 31 Dec 2009 GMT ; 31 Dec 09 ; 31-Dec-2009 ; 31/Dec/2009 ; 2009/12/31 ; 2009-12-31 ; 2009/12/31 ; 2009/12/31 23:59 ; 2009/12/31 - 23:59 ; 2009-12-31-23-59 ; 2009/12/31 - 23:59:59 ; 2009.12.31.23.59.59 . Date is assumed to be server time; add GMT to indicate Greenwich time zone. See also $TODAY() , $FORMATTIME() , $FORMATGMTIME() , $TIMEDIFF() . Example: %CALC{"$TIME( 2003/10/14 GMT )"}% returns 1066089600 |
-
-
- "$TIMEADD( serial, value, unit )" |
- Add a value to a serialized date. The unit is seconds if not specified; unit can be second , minute , hour , day , week , month , year . Note: An approximation is used for month and year calculations. See also $TIME() , $TIMEDIFF() , $TODAY() , $FORMATTIME() . Example: %CALC{"$TIMEADD( $TIME(), 2, week )"}% returns the serialized date two weeks from now |
-
-
- "$TIMEDIFF( serial_1, serial_2, unit )" |
- Time difference between two serialized dates. The unit is seconds if not specified; unit can be specified as in $TIMEADD() . Note: An approximation is used for month and year calculations. Use $FORMAT() or $INT() to format real numbers. See also $TIME() , $TIMEADD() , $TODAY() , $FORMATTIME() . Example: %CALC{"$TIMEDIFF( $TIME(), $EVAL($TIME()+90), minute )"}% returns 1.5 |
-
-
- "$TODAY()" |
- Get the serialized date of today at midnight GMT. The related $TIME() returns the serialized date of today at the current time, e.g. it includes the number of seconds since midnight GMT. See also $FORMATTIME() , $FORMATGMTIME() , $TIMEDIFF() . Example: %CALC{"$TODAY()"}% returns the number of seconds since Epoch |
-
-
- "$TRIM(text)" |
- Removes all spaces from text except for single spaces between words. Example: %CALC{"$TRIM( eat spaces )"}% returns eat spaces . |
-
-
- "$UPPER(text)" |
- The upper case string of a text. Example: %CALC{"$UPPER( $T(R1:C5) )"}% returns the upper case string of the text in cell R1:C5 |
-
-
+Conventions for Syntax:
+
+- Required parameters are indicated in