CGI CGI %CALC{"$INT(7/3)"}% are evaluated at page view time. They can be placed in table cells and outside of tables. In other words, this Plugin provides general formula evaluation capability, not just classic spreadsheet functions.
Example:
| Interactive example: | |||||||||||||||
The formula next to "Total" is CGI CGI %CALC{"$SUM( $ABOVE() )"}%. (you see the formula instead of the sum in case the Plugin is not installed or not enabled.) | ||||||||||||||||
CGI CGI %CALC{"..."}% variable, which gets rendered according to the built-in function(s) found between the quotes.
CGI CGI $FUNCNAME(parameter)
CGI CGI %CALC{"$SUM( R2:C$COLUMN(0)..R$ROW(-1):C$COLUMN(0) )"}%
CGI CGI %CALC{"$SUM( 3, 5, 7 )"}%
CGI CGI R1:C1. Table address matrix: CGI CGI R1:C1 | CGI CGI R1:C2 | CGI CGI R1:C3 | CGI CGI R1:C4 |
CGI CGI R2:C1 | CGI CGI R2:C2 | CGI CGI R2:C3 | CGI CGI R2:C4 |
CGI CGI "..", e.g. "row 1 through 20, column 3" is: CGI CGI R1:C3..R20:C3
CGI CGI %CALC{"$SUM( 3, 5, $T(R1:C7), R1:C11..R1:C15 )"}%
CGI CGI ( bold )
CGI CGI ( bold italic )
CGI CGI $ABOVE( )
CGI CGI %CALC{"$SUM($ABOVE())"}% returns the sum of cells above the current cell
CGI $LEFT(), CGI $RIGHT()
CGI CGI $ABS( num )
CGI CGI %CALC{"$ABS(-12.5)"}% returns CGI CGI 12.5
CGI $SIGN(), CGI $EVEN(), CGI $ODD()
CGI CGI $AND( list )
CGI CGI %CALC{"$AND(1, 0, 1)"}% returns CGI CGI 0
CGI $NOT(), CGI $IF(), CGI $OR()
CGI CGI $AVERAGE( list )
CGI CGI %CALC{"$AVERAGE(R2:C5..R$ROW(-1):C5)"}% returns the average of column 5, excluding the title row
CGI $LIST(), CGI $MAX(), CGI $MEDIAN(), CGI $MIN()
CGI CGI $CHAR( number )
CGI CGI %CALC{"$CHAR(97)"}% returns CGI CGI a
CGI $CODE()
CGI CGI $CODE( text )
CGI CGI %CALC{"$CODE(abc)"}% returns CGI CGI 97
CGI $CHAR()
CGI CGI $COLUMN( offset )
CGI CGI %CALC{"$COLUMN()"}% returns CGI CGI 2 for the second column
CGI $ROW(), CGI $T()
CGI CGI $COUNTITEMS( list )
CGI CGI %CALC{"$COUNTITEMS($ABOVE())"}% returns CGI CGI Closed: 1, Open: 2 assuming one cell above the current cell contains CGI CGI Closed and two cells contain CGI CGI Open
CGI $COUNTSTR(), CGI $LIST()
CGI CGI $COUNTSTR( list, str )
CGI CGI %CALC{"$COUNTSTR($ABOVE())"}% counts the number of non empty cells above the current cell
CGI CGI %CALC{"$COUNTSTR($ABOVE(), DONE)"}% counts the number of cells equal to CGI CGI DONE
CGI $COUNTITEMS(), CGI $LIST()
CGI CGI $DEF( list )
CGI CGI %CALC{"$DEF(R1:C1..R1:C3)"}%
CGI $COUNTSTR(), CGI $LISTIF(), CGI $LIST()
CGI 1234), binary integers (CGI 0b1110011), octal integers (CGI 01234), hexadecimal integers (CGI 0x1234) or of exponential notation (CGI 12.34e-56)
CGI CGI $EVAL( formula )
CGI CGI %CALC{"$EVAL( (5 * 3) / 2 + 1.1 )"}% returns CGI CGI 8.6
CGI $EXEC(), CGI $INT(), CGI $MOD(), CGI $ROUND(), CGI $VALUE()
CGI CGI $EVEN( num )
CGI CGI %CALC{"$EVEN(2)"}% returns CGI CGI 1
CGI $ABS(), CGI $MOD(), CGI $ODD(), CGI $SIGN()
CGI CGI 1 if they are exactly the same, or CGI CGI 0 if not
CGI CGI $EXACT( text1, text2 )
CGI CGI %CALC{"$EXACT(foo, Foo)"}% returns CGI CGI 0
CGI CGI %CALC{"$EXACT(foo, $LOWER(Foo))"}% returns CGI CGI 1
CGI $IF(), CGI $TRIM()
CGI CGI $EXEC( formula )
CGI CGI %CALC{"$SET(msg, $NOEXEC(Hi $GET(name)))"}% sets the CGI msg variable with raw formula CGI Hi $GET(name)
CGI CGI %CALC{"$SET(name, Tom) $EXEC($GET(msg))"}% executes content of CGI msg variable and returns CGI Hi Tom
CGI CGI %CALC{"$SET(name, Jerry) $EXEC($GET(msg))"}% returns CGI Hi Jerry
CGI $EVAL(), CGI $GET(), CGI $NOEXEC(), CGI $SET()
CGI TopicName? or a CGI TopicName? . Current web is used if web is not specified.
CGI CGI $EXISTS( topic )
CGI CGI %CALC{"$EXISTS(WebHome)"}% returns CGI CGI 1
CGI CGI %CALC{"$EXISTS(ThisDoesNotExist)"}% returns CGI CGI 0
CGI CGI $EXP( num )
CGI CGI %CALC{"$EXP(1)"}% returns CGI CGI 2.71828182845905
CGI $LN(), CGI $LOG()
CGI string, within another CGI text, and returns the number of the starting position of CGI string, from the first character of CGI text. This search is case sensitive and is not a regular expression search; use CGI $SEARCH() for regular expression searching. Starting position is 1; a 0 is returned if nothing is matched.
CGI CGI $FIND( string, text, start )
CGI CGI %CALC{"$FIND(f, fluffy)"}% returns CGI CGI 1
CGI CGI %CALC{"$FIND(f, fluffy, 2)"}% returns CGI CGI 4
CGI CGI %CALC{"$FIND(@, fluffy, 1)"}% returns CGI CGI 0
CGI $REPLACE(), CGI $SEARCH()
CGI type: CGI COMMA for comma format, such as CGI 12,345.68
CGI DOLLAR for Dollar format, such as CGI $12,345.68
CGI KB for Kilo Byte format, such as CGI 1205.63 KB
CGI MB for Mega Byte format, such as CGI 1.18 MB
CGI KBMB for Kilo/Mega/Giga/Tera Byte auto-adjust format
CGI NUMBER for number, such as CGI 12345.7
CGI PERCENT for percent format, such as CGI 12.3%
CGI precision indicates the the number of digits after the dot
CGI CGI $FORMAT( type, prec, number )
CGI CGI %CALC{"$FORMAT(COMMA, 2, 12345.6789)"}% returns CGI CGI 12,345.68
CGI CGI %CALC{"$FORMAT(DOLLAR, 2, 12345.67)"}% returns CGI CGI $12,345.68
CGI CGI %CALC{"$FORMAT(KB, 2, 1234567)"}% returns CGI CGI 1205.63 KB
CGI CGI %CALC{"$FORMAT(MB, 2, 1234567)"}% returns CGI CGI 1.18 MB
CGI CGI %CALC{"$FORMAT(KBMB, 2, 1234567)"}% returns CGI CGI 1.18 MB
CGI CGI %CALC{"$FORMAT(KBMB, 2, 1234567890)"}% returns CGI CGI 1.15 GB
CGI CGI %CALC{"$FORMAT(NUMBER, 1, 12345.67)"}% returns CGI CGI 12345.7
CGI CGI %CALC{"$FORMAT(PERCENT, 1, 0.1234567)"}% returns CGI CGI 12.3%
CGI $FORMATTIME(), CGI $FORMATTIMEDIFF(), CGI $ROUND()
CGI $FORMATTIME().
CGI CGI $FORMATGMTIME( serial, text )
CGI CGI %CALC{"$FORMATGMTIME(1041379200, $day $mon $year)"}% returns CGI CGI 01 Jan 2003
CGI $FORMATTIME(), CGI $FORMATTIMEDIFF(), CGI $TIME(), CGI $TIMEADD(), CGI $TIMEDIFF(), CGI $TODAY()
CGI text are expanded: CGI $second (seconds, 00..59); CGI $minute (minutes, 00..59); CGI $hour (hours, 00..23); CGI $day (day of month, 01..31); CGI $month (month, 01..12); CGI $mon (month in text format, Jan..Dec); CGI $year (4 digit year, 1999); CGI $ye (2 digit year, 99), CGI $wd (day number of the week, 1 for Sunday, 2 for Monday, etc), CGI $wday (day of the week, Sun..Sat), CGI $weekday (day of the week, Sunday..Saturday), CGI $yearday (day of the year, 1..365, or 1..366 in leap years). Date is assumed to be server time; add CGI GMT to indicate Greenwich time zone.
CGI CGI $FORMATTIME( serial, text )
CGI CGI %CALC{"$FORMATTIME(0, $year/$month/$day GMT)"}% returns CGI CGI 1970/01/01 GMT
CGI $FORMATGMTIME(), CGI $TIME(), CGI $FORMATTIMEDIFF(), CGI $TIMEADD(), CGI $TIMEDIFF(), CGI $TODAY()
CGI time to a human readable format, such as: CGI 12 hours and 3 minutes
CGI unit can be CGI second, CGI minute, CGI hour, CGI day, CGI month, CGI year. Note: An approximation is used for month and year calculations.
CGI precision indicates the number of output units to use
CGI CGI $FORMATTIMEDIFF( unit, precision, time )
CGI CGI %CALC{"$FORMATTIMEDIFF(min, 1, 200)"}% returns CGI CGI 3 hours
CGI CGI %CALC{"$FORMATTIMEDIFF(min, 2, 200)"}% returns CGI CGI 3 hours and 20 minutes
CGI CGI %CALC{"$FORMATTIMEDIFF(min, 1, 1640)"}% returns CGI CGI 1 day
CGI CGI %CALC{"$FORMATTIMEDIFF(min, 2, 1640)"}% returns CGI CGI 1 day and 3 hours
CGI CGI %CALC{"$FORMATTIMEDIFF(min, 3, 1640)"}% returns CGI CGI 1 day, 3 hours and 20 minutes
CGI $FORMATTIME(), CGI $TIME(), CGI $TIMEADD(), CGI $TIMEDIFF()
CGI $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.
CGI CGI $GET( name )
CGI CGI %CALC{"$GET(my_total)"}% returns the value of the CGI my_total variable
CGI $EXEC(), CGI $NOEXEC(), CGI $SET(), CGI $SETIFEMPTY(), CGI $SETM()
CGI CGI 0 means condition not met), or two numbers with a comparison operator CGI CGI < (less than), CGI CGI <= (less than or equal), CGI CGI == (equal), CGI CGI != (not equal), CGI CGI >= (greater than or equal), CGI CGI > (greater than).
CGI CGI $IF( condition, value if true, value if 0 )
CGI CGI %CALC{"$IF($T(R1:C5) > 1000, Over Budget, OK)"}% returns CGI CGI Over Budget if value in R1:C5 is over 1000, CGI CGI OK if not
CGI CGI %CALC{"$IF($EXACT($T(R1:C2),), empty, $T(R1:C2))"}% returns the content of R1:C2 or CGI CGI empty if empty
CGI CGI %CALC{"$SET(val, $IF($T(R1:C2) == 0, zero, $T(R1:C2)))"}% sets a variable conditionally
CGI $AND(), CGI $EXACT(), CGI $LISTIF(), CGI $NOT(), CGI $OR()
CGI 1234), binary integers (CGI 0b1110011), octal integers (CGI 01234), hexadecimal integers (CGI 0x1234) or of exponential notation (CGI 12.34e-56)
CGI CGI $INT( $VALUE( number ) )
CGI CGI $INT( formula )
CGI CGI %CALC{"$INT(10 / 4)"}% returns CGI CGI 2
CGI CGI %CALC{"$INT($VALUE(09))"}% returns CGI CGI 9
CGI $EVAL(), CGI $ROUND(), CGI $VALUE()
CGI CGI $LEFT( )
CGI CGI %CALC{"$SUM($LEFT())"}% returns the sum of cells to the left of the current cell
CGI $ABOVE(), CGI $RIGHT()
CGI CGI $LENGTH( text )
CGI CGI %CALC{"$LENGTH(abcd)"}% returns CGI CGI 4
CGI $LISTSIZE()
CGI CGI $LIST( range )
CGI CGI %CALC{"$LIST($LEFT())"}% returns CGI CGI Apples, Lemons, Oranges, Kiwis assuming the cells to the left contain CGI CGI | Apples | Lemons, Oranges | Kiwis |
CGI $AVERAGE(), CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $DEF(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTJOIN(), CGI $LISTMAP(), CGI $LISTRAND(), CGI $LISTREVERSE(), CGI $LISTSHUFFLE(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTTRUNCATE(), CGI $LISTUNIQUE(), CGI $MAX(), CGI $MEDIAN(), CGI $MIN(), CGI $PRODUCT(), CGI $SUM(), CGI $SUMDAYS(), CGI $SUMPRODUCT()
CGI $IF(), you can use CGI CGI $item to indicate the current element, and CGI CGI $index for the list index, starting at 1
CGI CGI $LISTIF( condition, list )
CGI CGI %CALC{"$LISTIF($item > 12, 14, 7, 25)"}% returns CGI CGI 14, 25
CGI CGI %CALC{"$LISTIF($NOT($EXACT($item,)), A, B, , E)"}% returns non-empty elements CGI CGI A, B, E
CGI CGI %CALC{"$LISTIF($index > 2, A, B, C, D)"}% returns CGI CGI C, D
CGI $IF(), CGI $LIST(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTREVERSE(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $SUM()
CGI CGI $LISTITEM( index, list )
CGI CGI %CALC{"$LISTITEM(2, Apple, Orange, Apple, Kiwi)"}% returns CGI CGI Orange
CGI CGI %CALC{"$LISTITEM(-1, Apple, Orange, Apple, Kiwi)"}% returns CGI CGI Kiwi
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTMAP(), CGI $LISTRAND(), CGI $LISTREVERSE(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $SUM()
CGI separator string, which may include CGI $comma for comma, CGI $n for newline, and CGI $sp for space.
CGI CGI $LISTJOIN( separator, list )
CGI CGI %CALC{"$LISTJOIN($n, Apple, Orange, Apple, Kiwi)"}% returns the four items separated by new lines
CGI $LIST(), CGI $LISTSIZE()
CGI CGI $item to indicate the element; CGI CGI $index to show the index of the list, starting at 1. If CGI CGI $item is omitted, the item is appended to the formula.
CGI CGI $LISTMAP( formula, list )
CGI CGI %CALC{"$LISTMAP($index: $EVAL(2 * $item), 3, 5, 7, 11)"}% returns CGI CGI 1: 6, 2: 10, 3: 14, 4: 22
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTREVERSE(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $SUM()
CGI CGI $LISTRAND( list )
CGI CGI %CALC{"$LISTRAND(Apple, Orange, Apple, Kiwi)"}% returns one of the four elements
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTSHUFFLE(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $RAND(), CGI $SUM()
CGI CGI $LISTREVERSE( list )
CGI CGI %CALC{"$LISTREVERSE(Apple, Orange, Apple, Kiwi)"}% returns CGI CGI Kiwi, Apple, Orange, Apple
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $SUM()
CGI CGI $LISTSIZE( list )
CGI CGI %CALC{"$LISTSIZE(Apple, Orange, Apple, Kiwi)"}% returns CGI CGI 4
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTJOIN(), CGI $LISTMAP(), CGI $LISTREVERSE(), CGI $LISTSORT(), CGI $LISTTRUNCATE(), CGI $LISTUNIQUE(), CGI $SUM()
CGI CGI $LISTSHUFFLE( list )
CGI CGI %CALC{"$LISTSHUFFLE(Apple, Orange, Apple, Kiwi)"}% returns the four elements in random order
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTRAND(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $RAND(), CGI $SUM()
CGI CGI $LISTSORT( list )
CGI CGI %CALC{"$LISTSORT(Apple, Orange, Apple, Kiwi)"}% returns CGI CGI Apple, Apple, Kiwi, Orange
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTREVERSE(), CGI $LISTSHUFFLE(), CGI $LISTSIZE(), CGI $LISTUNIQUE(), CGI $SUM()
CGI CGI $LISTTRUNCATE( size, list )
CGI CGI %CALC{"$LISTTRUNCATE(2, Apple, Orange, Kiwi)"}% returns CGI CGI Apple, Orange
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $LISTUNIQUE(), CGI $SUM()
CGI CGI $LISTUNIQUE( list )
CGI CGI %CALC{"$LISTUNIQUE(Apple, Orange, Apple, Kiwi)"}% returns CGI CGI Apple, Orange, Kiwi
CGI $COUNTITEMS(), CGI $COUNTSTR(), CGI $LIST(), CGI $LISTIF(), CGI $LISTITEM(), CGI $LISTMAP(), CGI $LISTREVERSE(), CGI $LISTSIZE(), CGI $LISTSORT(), CGI $SUM()
CGI CGI $LN( num )
CGI CGI %CALC{"$LN(10)"}% returns CGI CGI 2.30258509299405
CGI $EXP(), CGI $LOG()
CGI CGI $LOG( num, base )
CGI CGI %CALC{"$LOG(1000)"}% returns CGI CGI 3
CGI CGI %CALC{"$LOG(16, 2)"}% returns CGI CGI 4
CGI $EXP(), CGI $LN()
CGI CGI $LOWER(text)
CGI CGI %CALC{"$LOWER( $T(R1:C5) )"}% returns the lower case string of the text in cell CGI CGI R1:C5
CGI $PROPER(), CGI $PROPERSPACE(), CGI $TRIM(), CGI $UPPER()
CGI CGI $MAX( list )
CGI CGI %CALC{"$MAX($LEFT())"}%
CGI $LIST(), CGI $MEDIAN(), CGI $MIN(), CGI $PERCENTILE()
CGI CGI $MEDIAN( list )
CGI CGI %CALC{"$MEDIAN(3, 9, 4, 5)"}% returns CGI CGI 4.5
CGI $LIST(), CGI $MAX(), CGI $MIN(), CGI $PERCENTILE()
CGI CGI $MIN( list )
CGI CGI %CALC{"$MIN(15, 3, 28)"}% returns CGI CGI 3
CGI $LIST(), CGI $MAX(), CGI $MEDIAN(), CGI $PERCENTILE()
CGI CGI num by CGI CGI divisor CGI CGI $MOD( num, divisor )
CGI CGI %CALC{"$MOD(7, 3)"}% returns CGI CGI 1
CGI $EVAL()
CGI $EXEC().
CGI CGI $NOEXEC( formula )
CGI CGI %CALC{"$SET(msg, $NOEXEC(Hi $GET(name)))"}% sets the CGI msg variable with the formula CGI Hi $GET(name) without executing it
CGI $EVAL(), CGI $EXEC(), CGI $GET(), CGI $SET()
CGI %SEARCH{}% is evaluated. The percent character '%' can be escaped with CGI $per
CGI CGI $NOP( text )
CGI CGI num is not zero, 1 if zero
CGI CGI $NOT( num )
CGI CGI %CALC{"$NOT(0)"}% returns CGI CGI 1
CGI $AND(), CGI $IF(), CGI $OR()
CGI CGI $ODD( num )
CGI CGI %CALC{"$ODD(2)"}% returns CGI CGI 0
CGI $ABS(), CGI $EVEN(), CGI $MOD(), CGI $SIGN()
CGI CGI $OR( list )
CGI CGI %CALC{"$OR(1, 0, 1)"}% returns CGI CGI 1
CGI $AND(), CGI $IF(), CGI $NOT()
CGI CGI $PERCENTILE( num, list )
CGI CGI %CALC{"$PERCENTILE(75, 400, 200, 500, 100, 300)"}% returns CGI CGI 450
CGI $LIST(), CGI $MAX(), CGI $MEDIAN(), CGI $MIN()
CGI CGI $PI( )
CGI CGI %CALC{"$PI()"}% returns CGI CGI 3.14159265358979
CGI CGI $PRODUCT( list )
CGI CGI %CALC{"$PRODUCT($LEFT())"}%
CGI $LIST(), CGI $PRODUCT(), CGI $SUM(), CGI $SUMPRODUCT()
CGI CGI $PROPER( text )
CGI CGI %CALC{"$PROPER(a small STEP)"}% returns CGI CGI A Small Step
CGI CGI %CALC{"$PROPER(f1 (formula-1))"}% returns CGI CGI F1 (Formula-1)
CGI $LOWER(), CGI $PROPERSPACE(), CGI $TRIM(), CGI $UPPER()
CGI CGI ][. Words listed in the DONTSPACE TWikiPreferences variable or DONTSPACE Plugins setting are excluded
CGI CGI $PROPERSPACE( text )
CGI CGI %CALC{"$PROPERSPACE(Old MacDonald had a ServerFarm, EeEyeEeEyeOh)"}% returns CGI CGI Old MacDonald had a Server Farm, Ee Eye Ee Eye Oh
CGI $LOWER(), CGI $PROPER(), CGI $TRIM(), CGI $UPPER()
CGI CGI max, or 0 and 1 if max is not specified
CGI CGI $RAND( max )
CGI $EVAL(), CGI $LISTRAND(), CGI $LISTSHUFFLE()
CGI CGI $REPEAT( text, num )
CGI CGI %CALC{"$REPEAT(/\, 5)"}% returns CGI CGI /\/\/\/\/\
CGI num number of characters of text string CGI text, starting at CGI start, with new text CGI new. Starting position is 1; use a negative CGI start to count from the end of the text
CGI CGI $REPLACE( text, start, num, new )
CGI CGI %CALC{"$REPLACE(abcdefghijk,6,5,*)"}% returns CGI CGI abcde*k
CGI $FIND(), CGI $SEARCH(), CGI $SUBSTITUTE(), CGI $TRANSLATE()
CGI CGI $RIGHT( )
CGI CGI %CALC{"$SUM($RIGHT())"}% returns the sum of cells to the right of the current cell
CGI $ABOVE(), CGI $LEFT()
CGI CGI formula and rounds the result up or down to the number of digits if CGI CGI digits is positive; to the nearest integer if digits is missing; or to the left of the decimal point if digits is negative
CGI CGI $ROUND( formula, digits )
CGI CGI %CALC{"$ROUND(3.15, 1)"}% returns CGI CGI 3.2
CGI CGI %CALC{"$ROUND(3.149, 1)"}% returns CGI CGI 3.1
CGI CGI %CALC{"$ROUND(-2.475, 2)"}% returns CGI CGI -2.48
CGI CGI %CALC{"$ROUND(34.9, -1)"}% returns CGI CGI 30
CGI $INT(), CGI $FORMAT()
CGI CGI $ROW( offset )
CGI CGI %CALC{"$ROW(-2)"}%
CGI $COLUMN(), CGI $T()
CGI string, within another CGI text, and returns the number of the starting position of CGI string, from the first character of CGI text. This search is a RegularExpression search; use CGI $FIND() for non-regular expression searching. Starting position is 1; a 0 is returned if nothing is matched
CGI CGI $SEARCH( string, text, start )
CGI CGI %CALC{"$SEARCH([uy], fluffy)"}% returns CGI CGI 3
CGI CGI %CALC{"$SEARCH([uy], fluffy, 3)"}% returns CGI CGI 6
CGI CGI %CALC{"$SEARCH([abc], fluffy,)"}% returns CGI CGI 0
CGI $FIND(), CGI $REPLACE()
CGI $NOEXEC() if you want to prevent that. This function returns no output. Use CGI $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 and also across included topics
CGI CGI $SET( name, value )
CGI CGI %CALC{"$SET(my_total, $SUM($ABOVE()))"}% sets the CGI my_total variable to the sum of all table cells located above the current cell and returns an empty string
CGI $EXEC(), CGI $GET(), CGI $NOEXEC(), CGI $SETIFEMPTY(), CGI SETM()
CGI CGI $SETIFEMPTY( name, value )
CGI CGI %CALC{"$SETIFEMPTY(result, default)"}% sets the CGI result variable to CGI default if the variable is empty or 0; in any case an empty string is returned
CGI $GET(), CGI $SET()
CGI CGI + (add), CGI CGI - (subtract), CGI CGI * (multiply), or CGI CGI / (divide) something to the variable. This function returns no output. Use CGI $GET() to retrieve variables
CGI CGI $SETM( name, formula )
CGI CGI %CALC{"$SETM(total, + $SUM($LEFT()))"}% adds the sum of all table cells on the left to the CGI total variable, and returns an empty string
CGI $GET(), CGI $SET(), CGI $SETIFEMPTY()
CGI CGI num is negative, 0 if zero, or 1 if positive
CGI CGI $SIGN( num )
CGI CGI %CALC{"$SIGN(-12.5)"}% returns CGI CGI -1
CGI $ABS(), CGI $EVAL(), CGI $EVEN(), CGI $INT(), CGI $NOT(), CGI $ODD()
CGI CGI $SQRT( num )
CGI CGI %CALC{"$SQRT(16)"}% returns CGI CGI 4
CGI new text for CGI old text in a CGI text string. CGI instance specifies which occurance of CGI old you want to replace. If you specify CGI instance, only that instance is replaced. Otherwise, every occurance is changed to the new text. A literal search is performed by default; a RegularExpression search if the CGI option is set to CGI CGI r
CGI CGI $SUBSTITUTE( text, old, new, instance, option )
CGI CGI %CALC{"$SUBSTITUTE(Good morning, morning, day)"}% returns CGI CGI Good day
CGI CGI %CALC{"$SUBSTITUTE(Q2-2002,2,3)"}% returns CGI CGI Q3-3003
CGI CGI %CALC{"$SUBSTITUTE(Q2-2002,2,3,3)"}% returns CGI CGI Q2-2003
CGI CGI %CALC{"$SUBSTITUTE(abc123def,[0-9],9,,r)"}% returns CGI CGI abc999def
CGI $REPLACE(), CGI $TRANSLATE()
CGI CGI $SUM( list )
CGI CGI %CALC{"$SUM(R2:C5..R$ROW(-1):C5)"}% in the last row; or simply CGI CGI %CALC{"$SUM($ABOVE())"}%
CGI $LIST(), CGI $PRODUCT(), CGI $SUMPRODUCT(), CGI $WORKINGDAYS()
CGI CGI h, CGI CGI hours, CGI CGI d, CGI CGI days, CGI CGI w, CGI CGI weeks suffix. One week is assumed to have 5 working days, one day 8 hours
CGI CGI $SUMDAYS( list )
CGI CGI %CALC{"$SUMDAYS(2w, 1, 2d, 4h)"}% returns CGI CGI 13.5, the evaluation of CGI (2*5 + 1 + 2 + 4/8)
CGI $SUM(), CGI $TIME(), CGI $FORMATTIME()
CGI CGI $SUMPRODUCT( list, list, list... )
CGI CGI %CALC{"$SUMPRODUCT(R2:C1..R4:C1, R2:C5..R4:C5)"}% evaluates and returns the result of CGI CGI ($T(R2:C1) * $T(R2:C5) + $T(R3:C1) * $T(R3:C5) + $T(R4:C1) * $T(R4:C5))
CGI $LIST(), CGI $PRODUCT(), CGI $SUM()
CGI CGI $T( address )
CGI CGI %CALC{"$T(R1:C5)"}% returns the text in cell CGI CGI R1:C5
CGI $COLUMN(), CGI $ROW()
CGI from a set CGI to a set, one character by one. The CGI text may contain commas; all three parameters are required. In the CGI from and CGI to parameters you can write CGI $comma to escape comma, CGI $sp to escape space
CGI CGI $TRANSLATE( text, from, to )
CGI CGI %CALC{"$TRANSLATE(boom,bm,cl)"}% returns CGI CGI cool
CGI CGI %CALC{"$TRANSLATE(one, two,$comma,;)"}% returns CGI CGI one; two
CGI $REPLACE(), CGI $SUBSTITUTE()
CGI 31 Dec 2009; CGI 31 Dec 2009 GMT; CGI 31 Dec 09; CGI 31-Dec-2009; CGI 31/Dec/2009; CGI 2009/12/31; CGI 2009-12-31; CGI 2009/12/31; CGI 2009/12/31 23:59; CGI 2009/12/31 - 23:59; CGI 2009-12-31-23-59; CGI 2009/12/31 - 23:59:59; CGI 2009.12.31.23.59.59. Date is assumed to be server time; add CGI GMT to indicate Greenwich time zone
CGI CGI $TIME( text )
CGI CGI %CALC{"$TIME(2003/10/14 GMT)"}% returns CGI CGI 1066089600
CGI $FORMATGMTIME(), CGI $FORMATTIME(), CGI $FORMATTIMEDIFF(), CGI $TIMEADD(), CGI $TIMEDIFF(), CGI $TODAY(), CGI $WORKINGDAYS()
CGI unit is seconds if not specified; unit can be CGI second, CGI minute, CGI hour, CGI day, CGI week, CGI month, CGI year. Note: An approximation is used for month and year calculations
CGI CGI $TIMEADD( serial, value, unit )
CGI CGI %CALC{"$TIMEADD($TIME(), 2, week)"}% returns the serialized date two weeks from now
CGI $FORMATTIME(), CGI $FORMATGMTIME(), CGI $TIME(), CGI $TIMEDIFF(), CGI $TODAY()
CGI unit is seconds if not specified; unit can be specified as in CGI $TIMEADD(). Note: An approximation is used for month and year calculations. Use CGI $FORMAT(), CGI $FORMATTIMEDIFF() or CGI $INT() to format real numbers
CGI CGI $TIMEDIFF( serial_1, serial_2, unit )
CGI CGI %CALC{"$TIMEDIFF($TIME(), $EVAL($TIME()+90), minute)"}% returns CGI CGI 1.5
CGI $FORMAT(), CGI $FORMATGMTIME(), CGI $FORMATTIME(), CGI $FORMATTIMEDIFF(), CGI $INT(), CGI $TIME(), CGI $TIMEADD(), CGI $TODAY(), CGI $WORKINGDAYS()
CGI $TIME() returns the serialized date of today at the current time, e.g. it includes the number of seconds since midnight GMT
CGI CGI $TODAY( )
CGI CGI %CALC{"$TODAY()"}% returns the number of seconds since Epoch
CGI $FORMATTIME(), CGI $FORMATGMTIME(), CGI $TIME(), CGI $TIMEADD(), CGI $TIMEDIFF()
CGI CGI $TRIM( text )
CGI CGI %CALC{"$TRIM( eat spaces )"}% returns CGI CGI eat spaces
CGI $EXACT(), CGI $PROPERSPACE()
CGI CGI $UPPER( text )
CGI CGI %CALC{"$UPPER($T(R1:C5))"}% returns the upper case string of the text in cell CGI CGI R1:C5
CGI $LOWER(), CGI $PROPER(), CGI $PROPERSPACE(), CGI $TRIM()
CGI CGI text. Returns CGI CGI 0 if not found
CGI CGI $VALUE( text )
CGI CGI %CALC{"$VALUE(US$1,200)"}% returns CGI CGI 1200
CGI CGI %CALC{"$VALUE(PrjNotebook1234)"}% returns CGI CGI 1234
CGI CGI %CALC{"$VALUE(Total: -12.5)"}% returns CGI CGI -12.5
CGI $EVAL(), CGI $INT()
CGI CGI $WORKINGDAYS( serial_1, serial_2 )
CGI CGI %CALC{"$WORKINGDAYS($TIME(2004/07/15), $TIME(2004/08/03))"}% returns CGI CGI 13
CGI $SUMDAYS(), CGI $TIME(), CGI $TIMEDIFF()
CGI % signs of CGI %CALC{...}% with CGI $percnt. For example, to execute CGI $IF($EXACT($formfield(Tested), Yes), %PUBURL%/%SYSTEMWEB%/TWikiDocGraphics/choice-yes.gif, %PUBURL%/%SYSTEMWEB%/TWikiDocGraphics/choice-no.gif) in the CGI format="" parameter, write this:
CGI %SEARCH{ .... format="| $topic | $percntCALC{$IF($EXACT($formfield(Tested), Yes), %PUBURL%/%SYSTEMWEB%/TWikiDocGraphics/choice-yes.gif, %PUBURL%/%SYSTEMWEB%/TWikiDocGraphics/choice-no.gif)}$percnt |" }%
<!--
* Set MYFORMULA = $EVAL($SUBSTITUTE(...etc...))
-->
| A | 1 | %CALC{%MYFORMULA%}% |
| B | 2 | %CALC{%MYFORMULA%}% |
| C | 3 | %CALC{%MYFORMULA%}% |
| Bug#: | Priority: | Subject: | Status: | Days to fix |
|---|---|---|---|---|
| Bug:1231 | Low | File Open ... | Open | 3 |
| Bug:1232 | High | Memory Window ... | Fixed | 2 |
| Bug:1233 | Medium | Usability issue ... | Assigned | 5 |
| Bug:1234 | High | No arrange ... | Fixed | 1 |
| Total: 4 | High: 2 Low: 1 Medium: 1 |
. | Assigned: 1 Fixed: 2 Open: 1 |
Total: 11 |
| Total: %CALC{"$ROW(-2)"}% \
| %CALC{"$COUNTITEMS( R2:C$COLUMN()..R$ROW(-1):C$COLUMN() )"}% | . \
| %CALC{"$COUNTITEMS( R2:C$COLUMN()..R$ROW(-1):C$COLUMN() )"}% \
| Total: %CALC{"$SUM( R2:C$COLUMN()..R$ROW(-1):C$COLUMN() )"}% |
Above table is created manually. Another Plugin could build the table dynamically, e.g. by pulling data out of a bug tracking system. The Spreadsheet Plugin can be used to display table data statistics.
CGI CGI %<plugin>_<setting>%, i.e. CGI CGI %SPREADSHEETPLUGIN_SHORTDESCRIPTION%
CGI "$SUM( $ABOVE() )" to TWiki tables and other topic text
CGI data/debug.txt) CGI %CALC{}% variable in included topic while including topic: (default: 1) CGI CGI $PROPERSPACE(text) function. This comma delimited list can be overloaded by a DONTSPACE preferences variable: