none
[openafs-wiki.git] / TWiki / SpreadSheetPlugin.mdwn
1 # <a name="TWiki Spreadsheet Plugin"></a><a name=" TWiki Spreadsheet Plugin"></a> TWiki Spreadsheet Plugin
2
3 This Plugin adds speadsheet capabilities to %WIKITOOLNAME% topics. Formulae like <code>**%CALC\{"$INT(7/3)"\}%**</code> 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.
4
5 <table>
6   <tr>
7     <td valign="top"><strong><em>Example:</em></strong><p>
8       </p>
9       <table border="1" cellpadding="0" cellspacing="0">
10         <tr>
11           <th bgcolor="#99CCCC"><strong> Region: </strong></th>
12           <th bgcolor="#99CCCC"><strong> Sales: </strong></th>
13         </tr>
14         <tr>
15           <td> Northeast </td>
16           <td align="right"> 320 </td>
17         </tr>
18         <tr>
19           <td> Northwest </td>
20           <td align="right"> 580 </td>
21         </tr>
22         <tr>
23           <td> South </td>
24           <td align="right"> 240 </td>
25         </tr>
26         <tr>
27           <td> Europe </td>
28           <td align="right"> 610 </td>
29         </tr>
30         <tr>
31           <td> Asia </td>
32           <td align="right"> 220 </td>
33         </tr>
34         <tr>
35           <td> Total: </td>
36           <td align="right"> 1970 </td>
37         </tr>
38       </table>
39       <p>
40       </p>
41     </td>
42     <td>     </td>
43     <td valign="top"><strong><em>Interactive example:</em></strong><p>
44       </p>
45       <form action="http://www.dementia.org/twiki//view/%WEB%/%TOPIC%" method="get" name="interactive"> Formula: <code>%CALC{"</code><input name="formula" size="40" type="text" value="$PROPERSPACE(admin)" /><code>"}%</code>   <input type="submit" value="Go" /><br /> Result:     admin <p>
46         </p>
47       </form>
48     </td>
49   </tr>
50   <tr>
51     <td colspan="3"> The formula next to "Total" is <code><b>%CALC{"$SUM( $ABOVE() )"}%</b></code>. <br /> (you see the formula instead of the sum in case the Plugin is not installed or not enabled.) </td>
52   </tr>
53 </table>
54
55 <div>
56   <ul>
57     <li><a href="#Syntax Rules"> Syntax Rules</a></li>
58     <li><a href="#Built-in Functions"> Built-in Functions</a><ul>
59         <li><a href="#ABOVE( ) -- address range of cel"> ABOVE( ) -- address range of cells above the current cell</a></li>
60         <li><a href="#ABS( num ) -- absolute value of"> ABS( num ) -- absolute value of a number</a></li>
61         <li><a href="#AND( list ) -- logcial AND of a"> AND( list ) -- logcial AND of a list</a></li>
62         <li><a href="#AVERAGE( list ) -- average of a"> AVERAGE( list ) -- average of a list or a range of cells</a></li>
63         <li><a href="#CHAR( number ) -- ASCII characte"> CHAR( number ) -- ASCII character represented by number</a></li>
64         <li><a href="#CODE( text ) -- ASCII numeric va"> CODE( text ) -- ASCII numeric value of character</a></li>
65         <li><a href="#COLUMN( offset ) -- current colu"> COLUMN( offset ) -- current column number</a></li>
66         <li><a href="#COUNTITEMS( list ) -- count indi"> COUNTITEMS( list ) -- count individual items in a list</a></li>
67         <li><a href="#COUNTSTR( list, str ) -- count t"> COUNTSTR( list, str ) -- count the number of cells in a list equal to a given string</a></li>
68         <li><a href="#DEF( list ) -- find first non-em"> DEF( list ) -- find first non-empty list item or cell</a></li>
69         <li><a href="#EVAL( formula ) -- evaluate a si"> EVAL( formula ) -- evaluate a simple formula</a></li>
70         <li><a href="#EXACT( text1, text2 ) -- compare"> EXACT( text1, text2 ) -- compare two text strings</a></li>
71         <li><a href="#FIND( string, text, start ) -- f"> FIND( string, text, start ) -- find one string within another string</a></li>
72         <li><a href="#FORMAT( type, prec, number ) --"> FORMAT( type, prec, number ) -- format a number to a certain type and precision</a></li>
73         <li><a href="#FORMATTIME( serial, text ) -- co"> FORMATTIME( serial, text ) -- convert a serialized date into a date string</a></li>
74         <li><a href="#FORMATGMTIME( serial, text ) --"> FORMATGMTIME( serial, text ) -- convert a serialized date into a GMT date string</a></li>
75         <li><a href="#GET( name ) -- get the value of"> GET( name ) -- get the value of a previously set variable</a></li>
76         <li><a href="#IF( condition, value if true, va"> IF( condition, value if true, value if 0 ) -- return a value based on a condition</a></li>
77         <li><a href="#INT( formula ) -- evaluate formu"> INT( formula ) -- evaluate formula and round down to nearest integer</a></li>
78         <li><a href="#LEFT( ) -- address range of cell"> LEFT( ) -- address range of cells to the left of the current cell</a></li>
79         <li><a href="#LENGTH( text ) -- length of text"> LENGTH( text ) -- length of text in bytes</a></li>
80         <li><a href="#LIST( range ) -- convert content"> LIST( range ) -- convert content of a cell range into a list</a></li>
81         <li><a href="#LISTIF( condition, list ) -- rem"> LISTIF( condition, list ) -- remove elements from a list that do not meet a condition</a></li>
82         <li><a href="#LISTITEM( index, list ) -- get o"> LISTITEM( index, list ) -- get one element of a list</a></li>
83         <li><a href="#LISTMAP( formula, list ) -- eval"> LISTMAP( formula, list ) -- evaluate and update each element of a list</a></li>
84         <li><a href="#LISTREVERSE( list ) -- opposite"> LISTREVERSE( list ) -- opposite order of a list</a></li>
85         <li><a href="#LISTSIZE( list ) -- number of el"> LISTSIZE( list ) -- number of elements in a list</a></li>
86         <li><a href="#LISTSORT( list ) -- sort a list"> LISTSORT( list ) -- sort a list</a></li>
87         <li><a href="#LISTUNIQUE( list ) -- remove all"> LISTUNIQUE( list ) -- remove all duplicates from a list</a></li>
88         <li><a href="#LOWER( text ) -- lower case stri"> LOWER( text ) -- lower case string of a text</a></li>
89         <li><a href="#MAX( list ) - biggest value of a"> MAX( list ) - biggest value of a list or range of cells</a></li>
90         <li><a href="#MEDIAN( list ) -- median of a li"> MEDIAN( list ) -- median of a list or range of cells</a></li>
91         <li><a href="#MIN( list ) -- smallest value of"> MIN( list ) -- smallest value of a list or range of cells</a></li>
92         <li><a href="#MOD( num, divisor ) -- reminder"> MOD( num, divisor ) -- reminder after dividing num by divisor</a></li>
93         <li><a href="#NOP( text ) -- no-operation"> NOP( text ) -- no-operation</a></li>
94         <li><a href="#NOT( num ) -- reverse logic of a"> NOT( num ) -- reverse logic of a number</a></li>
95         <li><a href="#OR( list ) -- logcial OR of a li"> OR( list ) -- logcial OR of a list</a></li>
96         <li><a href="#PRODUCT( list ) -- product of a"> PRODUCT( list ) -- product of a list or range of cells</a></li>
97         <li><a href="#PROPER( text ) -- properly capit"> PROPER( text ) -- properly capitalize trxt</a></li>
98         <li><a href="#PROPERSPACE( text ) -- properly"> PROPERSPACE( text ) -- properly space out WikiWords</a></li>
99         <li><a href="#RAND( max ) -- random number"> RAND( max ) -- random number</a></li>
100         <li><a href="#REPEAT(text) -- repeat text a nu"> REPEAT(text) -- repeat text a number of times</a></li>
101         <li><a href="#REPLACE( text, start, num, new )"> REPLACE( text, start, num, new ) -- replace part of a text string</a></li>
102         <li><a href="#RIGHT( ) -- address range of cel"> RIGHT( ) -- address range of cells to the right of the current cell</a></li>
103         <li><a href="#ROUND( formula, digits ) -- roun"> ROUND( formula, digits ) -- round a number</a></li>
104         <li><a href="#ROW( offset ) -- current row num"> ROW( offset ) -- current row number</a></li>
105         <li><a href="#SEARCH( string, text, start ) --"> SEARCH( string, text, start ) -- search a string within a text</a></li>
106         <li><a href="#SET( name, value ) -- set a vari"> SET( name, value ) -- set a variable for later use</a></li>
107         <li><a href="#SETM( name, formula ) -- update"> SETM( name, formula ) -- update an existing variable based on a formula</a></li>
108         <li><a href="#SIGN( num ) -- sign of a number"> SIGN( num ) -- sign of a number</a></li>
109         <li><a href="#SUBSTITUTE( text, old, new, inst"> SUBSTITUTE( text, old, new, instance, option ) -- substitute text</a></li>
110         <li><a href="#SUM( list ) -- sum of a list or"> SUM( list ) -- sum of a list or range of cells</a></li>
111         <li><a href="#SUMDAYS( list ) -- sum the days"> SUMDAYS( list ) -- sum the days in a list or range of cells</a></li>
112         <li><a href="#SUMPRODUCT( list, list ) -- scal"> SUMPRODUCT( list, list ) -- scalar product on ranges of cells</a></li>
113         <li><a href="#T( address ) -- content of a cel"> T( address ) -- content of a cell</a></li>
114         <li><a href="#TRANSLATE( text, from, to ) -- t"> TRANSLATE( text, from, to ) -- translate text from one set of characters to another</a></li>
115         <li><a href="#TIME( text ) -- convert a date s"> TIME( text ) -- convert a date string into a serialized date number</a></li>
116         <li><a href="#TIMEADD( serial, value, unit ) -"> TIMEADD( serial, value, unit ) -- add a value to a serialized date</a></li>
117         <li><a href="#TIMEDIFF( serial_1, serial_2, un"> TIMEDIFF( serial_1, serial_2, unit ) -- time difference between two serialized dates</a></li>
118         <li><a href="#TODAY( ) -- serialized date of t"> TODAY( ) -- serialized date of today at midnight GMT</a></li>
119         <li><a href="#TRIM( text ) -- trim spaces from"> TRIM( text ) -- trim spaces from text</a></li>
120         <li><a href="#UPPER( text ) -- upper case stri"> UPPER( text ) -- upper case string of a text</a></li>
121         <li><a href="#VALUE( text ) -- convert text to"> VALUE( text ) -- convert text to number</a></li>
122         <li><a href="#WORKINGDAYS( serial_1, serial_2"> WORKINGDAYS( serial_1, serial_2 ) -- working days between two serialized dates</a></li>
123       </ul>
124     </li>
125     <li><a href="#Bug Tracking Example"> Bug Tracking Example</a></li>
126     <li><a href="#Plugin Settings"> Plugin Settings</a></li>
127     <li><a href="#Plugin Installation Instructions"> Plugin Installation Instructions</a></li>
128     <li><a href="#Plugin Info"> Plugin Info</a></li>
129   </ul>
130 </div>
131
132 ## <a name="Syntax Rules"></a> Syntax Rules
133
134 The action of this Plugin is triggered by the <code>**%CALC\{"..."\}%**</code> variable, which gets rendered according to the built-in function(s) found between the quotes.
135
136 - Built-in function are of format <code>**$FUNCNAME(parameter)**</code>
137 - Functions may be nested, e.g. <code>**%CALC\{"$SUM( R2:C$COLUMN(0)..R$ROW(-1):C$COLUMN(0) )"\}%**</code>
138 - Functions are evaluated from left to right, and from inside to outside if nested
139 - The function parameter can be text; a mathematical formula; a cell address; or a range of cell addresses
140 - Multiple parameters form a list; they are separated by a comma, followed by optional space, e.g. <code>**%CALC\{"$SUM( 3, 5, 7 )"\}%**</code>
141 - A table cell can be addressed as <code>**R1:C1**</code>. Table address matrix: <table border="1" cellpadding="0" cellspacing="0">
142   <tr>
143     <td><code><b>R1:C1</b></code></td>
144     <td><code><b>R1:C2</b></code></td>
145     <td><code><b>R1:C3</b></code></td>
146     <td><code><b>R1:C4</b></code></td>
147   </tr>
148   <tr>
149     <td><code><b>R2:C1</b></code></td>
150     <td><code><b>R2:C2</b></code></td>
151     <td><code><b>R2:C3</b></code></td>
152     <td><code><b>R2:C4</b></code></td>
153   </tr>
154 </table>
155 - A table cell range is defined by two cell addresses separated by <code>**".."**</code>, e.g. "row 1 through 20, column 3" is: <code>**R1:C3..R20:C3**</code>
156 - Lists can refer to values and/or table cell ranges, e.g. <code>**%CALC\{"$SUM( 3, 5, $T(R1:C7), R1:C11..R1:C15 )"\}%**</code>
157 - Formulae can only reference cells in the current or preceeding row of the current table; they may not reference cells below the current table row
158 - Formulae can also be placed outside of tables; they can reference cells in the preceeding table
159
160 ## <a name="Built-in Functions"></a> Built-in Functions
161
162 Conventions for Syntax:
163
164 - Required parameters are indicated in <code>**( bold )**</code>
165 - Optional parameters are indicated in <code>**( _bold italic_ )**</code>
166
167 <a name="FuncABOVE"></a>
168
169 ### <a name="ABOVE( ) -- address range of cel"></a> ABOVE( ) -- address range of cells above the current cell
170
171 - Syntax: <code>**$ABOVE( )**</code>
172 - Example: <code>**%CALC\{"$SUM($ABOVE())"\}%**</code> returns the sum of cells above the current cell
173 - Related: <code>[[$LEFT()|Main/WebHome#FuncLEFT]]</code>, <code>[[$RIGHT()|Main/WebHome#FuncRIGHT]]</code>
174
175 <a name="FuncABS"></a>
176
177 ### <a name="ABS( num ) -- absolute value of"></a><a name="ABS( num ) -- absolute value of "></a> ABS( num ) -- absolute value of a number
178
179 - Syntax: <code>**$ABS( num )**</code>
180 - Example: <code>**%CALC\{"$ABS(-12.5)"\}%**</code> returns <code>**12\.5**</code>
181 - Related: <code>[[$SIGN()|Main/WebHome#FuncSIGN]]</code>
182
183 <a name="FuncAND"></a>
184
185 ### <a name="AND( list ) -- logcial AND of a"></a><a name="AND( list ) -- logcial AND of a "></a> AND( list ) -- logcial AND of a list
186
187 - Syntax: <code>**$AND( list )**</code>
188 - Example: <code>**%CALC\{"$AND(1, 0, 1)"\}%**</code> returns <code>****</code>
189 - Related: <code>[[$NOT()|Main/WebHome#FuncNOT]]</code>, <code>[[$IF()|Main/WebHome#FuncIF]]</code>, <code>[[$OR()|Main/WebHome#FuncOR]]</code>
190
191 <a name="FuncAVERAGE"></a>
192
193 ### <a name="AVERAGE( list ) -- average of a"></a><a name="AVERAGE( list ) -- average of a "></a> AVERAGE( list ) -- average of a list or a range of cells
194
195 - Syntax: <code>**$AVERAGE( list )**</code>
196 - Example: <code>**%CALC\{"$AVERAGE(R2:C5..R$ROW(-1):C5)"\}%**</code> returns the average of column 5, excluding the title row
197 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$MAX()|Main/WebHome#FuncMAX]]</code>, <code>[[$MEDIAN()|Main/WebHome#FuncMEDIAN]]</code>, <code>[[$MIN()|Main/WebHome#FuncMIN]]</code>
198
199 <a name="FuncCHAR"></a>
200
201 ### <a name="CHAR( number ) -- ASCII characte"></a> CHAR( number ) -- ASCII character represented by number
202
203 - Syntax: <code>**$CHAR( number )**</code>
204 - Example: Example: <code>**%CALC\{"$CHAR(97)"\}%**</code> returns <code>**a**</code>
205 - Related: <code>[[$CODE()|Main/WebHome#FuncCODE]]</code>
206
207 <a name="FuncCODE"></a>
208
209 ### <a name="CODE( text ) -- ASCII numeric va"></a> CODE( text ) -- ASCII numeric value of character
210
211 - The ASCII numeric value of the first character in text
212 - Syntax: <code>**$CODE( text )**</code>
213 - Example: <code>**%CALC\{"$CODE(abc)"\}%**</code> returns <code>**97**</code>
214 - Related: <code>[[$CHAR()|Main/WebHome#FuncCHAR]]</code>
215
216 <a name="FuncCOLUMN"></a>
217
218 ### <a name="COLUMN( offset ) -- current colu"></a> COLUMN( offset ) -- current column number
219
220 - The current table column number with an optional offset
221 - Syntax: <code>**$COLUMN( _offset_ )**</code>
222 - Example: <code>**%CALC\{"$COLUMN()"\}%**</code> returns <code>**2**</code> for the second column
223 - Related: <code>[[$ROW()|Main/WebHome#FuncROW]]</code>, <code>[[$T()|Main/WebHome#FuncT]]</code>
224
225 <a name="FuncCOUNTITEMS"></a>
226
227 ### <a name="COUNTITEMS( list ) -- count indi"></a> COUNTITEMS( list ) -- count individual items in a list
228
229 - Syntax: <code>**$COUNTITEMS( list )**</code>
230 - Example: <code>**%CALC\{"$COUNTITEMS($ABOVE())"\}%**</code> returns <code>**Closed: 1, Open: 2**</code> assuming one cell above the current cell contains <code>**Closed**</code> and two cells contain <code>**Open**</code>
231 - Related: <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>
232
233 <a name="FuncCOUNTSTR"></a>
234
235 ### <a name="COUNTSTR( list, str ) -- count t"></a> COUNTSTR( list, str ) -- count the number of cells in a list equal to a given string
236
237 - Count 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
238 - Syntax: <code>**$COUNTSTR( list, _str_ )**</code>
239 - Example: <code>**%CALC\{"$COUNTSTR($ABOVE())"\}%**</code> counts the number of non empty cells above the current cell
240 - Example: <code>**%CALC\{"$COUNTSTR($ABOVE(), DONE)"\}%**</code> counts the number of cells equal to <code>**DONE**</code>
241 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>
242
243 <a name="FuncDEF"></a>
244
245 ### <a name="DEF( list ) -- find first non-em"></a> DEF( list ) -- find first non-empty list item or cell
246
247 - Returns the first list item or cell reference that is not empty
248 - Syntax: <code>**$DEF( list )**</code>
249 - Example: <code>**%CALC\{"$DEF(R1:C1..R1:C3)"\}%**</code>
250 - Related: <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>
251
252 <a name="FuncEVAL"></a>
253
254 ### <a name="EVAL( formula ) -- evaluate a si"></a> EVAL( formula ) -- evaluate a simple formula
255
256 - Addition, substraction, multiplication, division and modulus of numbers are supported. Any nesting is permitted
257 - Syntax: <code>**$EVAL( formula )**</code>
258 - Example: <code>**%CALC\{"$EVAL( (5 \* 3) / 2 + 1.1 )"\}%**</code> returns <code>**8\.6**</code>
259 - Related: <code>[[$INT()|Main/WebHome#FuncINT]]</code>, <code>[[$MOD()|Main/WebHome#FuncMOD]]</code>, <code>[[$ROUND()|Main/WebHome#FuncROUND]]</code>, <code>[[$VALUE()|Main/WebHome#FuncVALUE]]</code>
260
261 <a name="FuncEXACT"></a>
262
263 ### <a name="EXACT( text1, text2 ) -- compare"></a> EXACT( text1, text2 ) -- compare two text strings
264
265 - Compares two text strings and returns <code>**1**</code> if they are exactly the same, or <code>****</code> if not
266 - Syntax: <code>**$EXACT( text1, _text2_ )**</code>
267 - Example: <code>**%CALC\{"$EXACT(foo, Foo)"\}%**</code> returns <code>****</code>
268 - Example: <code>**%CALC\{"$EXACT(foo, $LOWER(Foo))"\}%**</code> returns <code>**1**</code>
269 - Related: <code>[[$IF()|Main/WebHome#FuncIF]]</code>, <code>[[$TRIM()|Main/WebHome#FuncTRIM]]</code>
270
271 <a name="FuncFIND"></a>
272
273 ### <a name="FIND( string, text, start ) -- f"></a> FIND( string, text, start ) -- find one string within another string
274
275 - Finds one text `string`, within another `text`, and returns the number of the starting position of `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; a 0 is returned if nothing is matched.
276 - Syntax: <code>**$FIND( string, text, _start_ )**</code>
277 - Example: <code>**%CALC\{"$FIND(f, fluffy)"\}%**</code> returns <code>**1**</code>
278 - Example: <code>**%CALC\{"$FIND(f, fluffy, 2)"\}%**</code> returns <code>**4**</code>
279 - Example: <code>**%CALC\{"$FIND(@, fluffy, 1)"\}%**</code> returns <code>****</code>
280 - Related: <code>[[$REPLACE()|Main/WebHome#FuncREPLACE]]</code>, <code>[[$SEARCH()|Main/WebHome#FuncSEARCH]]</code>
281
282 <a name="FuncFORMAT"></a>
283
284 ### <a name="FORMAT( type, prec, number ) --"></a><a name="FORMAT( type, prec, number ) -- "></a> FORMAT( type, prec, number ) -- format a number to a certain type and precision
285
286 - Type can be COMMA for comma format, DOLLAR for Dollar format, NUMBER for number, and PERCENT for percent format
287 - Syntax: <code>**$FORMAT( type, prec, number )**</code>
288 - Example: <code>**%CALC\{"$FORMAT(COMMA, 2, 12345.6789)"\}%**</code> returns <code>**12,345.68**</code>
289 - Example: <code>**%CALC\{"$FORMAT(DOLLAR, 2, 12345.67)"\}%**</code> returns <code>**$12,345.68**</code>
290 - Example: <code>**%CALC\{"$FORMAT(NUMBER, 1, 12345.67)"\}%**</code> returns <code>**12345\.7**</code>
291 - Example: <code>**%CALC\{"$FORMAT(PERCENT, 1, 0.1234567)"\}%**</code> returns <code>**12\.3%**</code>
292 - Related: <code>[[$ROUND()|Main/WebHome#FuncROUND]]</code>
293
294 <a name="FuncFORMATTIME"></a>
295
296 ### <a name="FORMATTIME( serial, text ) -- co"></a> FORMATTIME( serial, text ) -- convert a serialized date into a date string
297
298 - 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.
299 - Syntax: <code>**$FORMATTIME( serial, text )**</code>
300 - Example: <code>**%CALC\{"$FORMATTIME(0, $year/$month/$day GMT)"\}%**</code> returns <code>**1970/01/01 GMT**</code>
301 - Related: <code>[[$FORMATGMTIME()|Main/WebHome#FuncFORMATGMTIME]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$TIMEADD()|Main/WebHome#FuncTIMEADD]]</code>, <code>[[$TIMEDIFF()|Main/WebHome#FuncTIMEDIFF]]</code>, <code>[[$TODAY()|Main/WebHome#FuncTODAY]]</code>
302
303 <a name="FuncFORMATGMTIME"></a>
304
305 ### <a name="FORMATGMTIME( serial, text ) --"></a><a name="FORMATGMTIME( serial, text ) -- "></a> FORMATGMTIME( serial, text ) -- convert a serialized date into a GMT date string
306
307 - The date string represents the time in Greenwich time zone. Same variable expansion as in `$FORMATTIME()`.
308 - Syntax: <code>**$FORMATGMTIME( serial, text )**</code>
309 - Example: <code>**%CALC\{"$FORMATGMTIME(1041379200, $day $mon $year)"\}%**</code> returns <code>**01 Jan 2003**</code>
310 - Related: <code>[[$FORMATTIME()|Main/WebHome#FuncFORMATTIME]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$TIMEADD()|Main/WebHome#FuncTIMEADD]]</code>, <code>[[$TIMEDIFF()|Main/WebHome#FuncTIMEDIFF]]</code>, <code>[[$TODAY()|Main/WebHome#FuncTODAY]]</code>
311
312 <a name="FuncGET"></a>
313
314 ### <a name="GET( name ) -- get the value of"></a><a name="GET( name ) -- get the value of "></a> GET( name ) -- get the value of a previously set variable
315
316 - 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.
317 - Syntax: <code>**$GET( name )**</code>
318 - Example: <code>**%CALC\{"$GET(my\_total)"\}%**</code> returns the value of the `my_total` variable
319 - Related: <code>[[$SET()|Main/WebHome#FuncSET]]</code>, <code>[[$SETM()|Main/WebHome#FuncSETM]]</code>
320
321 <a name="FuncIF"></a>
322
323 ### <a name="IF( condition, value if true, va"></a> IF( condition, value if true, value if 0 ) -- return a value based on a condition
324
325 - The condition can be a number (where <code>****</code> means condition not met), or two numbers with a comparison operator <code>**&lt;**</code> (less than), <code>**&lt;=**</code> (less than or equal), <code>**==**</code> (equal), <code>**!=**</code> (not equal), <code>**&gt;=**</code> (greater than or equal), <code>**&gt;**</code> (greater than).
326 - Syntax: <code>**$IF( condition, value if true, value if 0 )**</code>
327 - Example: <code>**%CALC\{"$IF($T(R1:C5) &gt; 1000, Over Budget, OK)"\}%**</code> returns <code>**Over Budget**</code> if value in R1:C5 is over 1000, <code>**OK**</code> if not
328 - Example: <code>**%CALC\{"$IF($EXACT($T(R1:C2),), empty, $T(R1:C2))"\}%**</code> returns the content of R1:C2 or <code>**empty**</code> if empty
329 - Example: <code>**%CALC\{"$SET(val, $IF($T(R1:C2) == 0, zero, $T(R1:C2)))"\}%**</code> sets a variable conditionally
330 - Related: <code>[[$AND()|Main/WebHome#FuncAND]]</code>, <code>[[$EXACT()|Main/WebHome#FuncEXACT]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$NOT()|Main/WebHome#FuncNOT]]</code>, <code>[[$OR()|Main/WebHome#FuncOR]]</code>
331
332 <a name="FuncINT"></a>
333
334 ### <a name="INT( formula ) -- evaluate formu"></a> INT( formula ) -- evaluate formula and round down to nearest integer
335
336 - Addition, substraction, multiplication, division and modulus of numbers are supported. Any nesting is permitted
337 - Syntax: <code>**$INT( formula )**</code>
338 - Example: <code>**%CALC\{"$INT(10 / 4)"\}%**</code> returns <code>**2**</code>
339 - Related: <code>[[$EVAL()|Main/WebHome#FuncEVAL]]</code>, <code>[[$ROUND()|Main/WebHome#FuncROUND]]</code>, <code>[[$VALUE()|Main/WebHome#FuncVALUE]]</code>
340
341 <a name="FuncLEFT"></a>
342
343 ### <a name="LEFT( ) -- address range of cell"></a> LEFT( ) -- address range of cells to the left of the current cell
344
345 - Syntax: <code>**$LEFT( )**</code>
346 - Example: <code>**%CALC\{"$SUM($LEFT())"\}%**</code> returns the sum of cells to the left of the current cell
347 - Related: <code>[[$ABOVE()|Main/WebHome#FuncABOVE]]</code>, <code>[[$RIGHT()|Main/WebHome#FuncRIGHT]]</code>
348
349 <a name="FuncLENGTH"></a>
350
351 ### <a name="LENGTH( text ) -- length of text"></a> LENGTH( text ) -- length of text in bytes
352
353 - Syntax: <code>**$LENGTH( text )**</code>
354 - Example: <code>**%CALC\{"$LENGTH(abcd)"\}%**</code> returns <code>**4**</code>
355 - Related: <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>
356
357 <a name="FuncLIST"></a>
358
359 ### <a name="LIST( range ) -- convert content"></a> LIST( range ) -- convert content of a cell range into a list
360
361 - Convert the content of a range of cells into a flat list, delimited by comma. Cells containing commas are merged into the list
362 - Syntax: <code>**$LIST( range )**</code>
363 - Example: <code>**%CALC\{"$LIST($LEFT())"\}%**</code> returns <code>**Apples, Lemons, Oranges, Kiwis**</code> assuming the cells to the left contain <code>**| Apples | Lemons, Oranges | Kiwis |**</code>
364 - Related: <code>[[$AVERAGE()|Main/WebHome#FuncAVERAGE]]</code>, <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$DEF()|Main/WebHome#FuncDEF]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$MAX()|Main/WebHome#FuncMAX]]</code>, <code>[[$MEDIAN()|Main/WebHome#FuncMEDIAN]]</code>, <code>[[$MIN()|Main/WebHome#FuncMIN]]</code>, <code>[[$PRODUCT()|Main/WebHome#FuncPRODUCT]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>, <code>[[$SUMDAYS()|Main/WebHome#FuncSUMDAYS]]</code>, <code>[[$SUMPRODUCT()|Main/WebHome#FuncSUMPRODUCT]]</code>
365
366 <a name="FuncLISTIF"></a>
367
368 ### <a name="LISTIF( condition, list ) -- rem"></a> LISTIF( condition, list ) -- remove elements from a list that do not meet a condition
369
370 - In addition to the condition described in <code>[[$IF()|Main/WebHome#FuncIF]]</code>, you can use <code>**$item**</code> to indicate the current element, and <code>**$index**</code> for the list index, starting at 1
371 - Syntax: <code>**$LISTIF( condition, list )**</code>
372 - Example: <code>**%CALC\{"$LISTIF($item &gt; 12, 14, 7, 25)"\}%**</code> returns <code>**14, 25**</code>
373 - Example: <code>**%CALC\{"$LISTIF($NOT($EXACT($item,)), A, B, , E)"\}%**</code> returns non-empty elements <code>**A, B, E**</code>
374 - Example: <code>**%CALC\{"$LISTIF($index &gt; 2, A, B, C, D)"\}%**</code> returns <code>**C, D**</code>
375 - Related: <code>[[$IF()|Main/WebHome#FuncIF]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
376
377 <a name="FuncLISTITEM"></a>
378
379 ### <a name="LISTITEM( index, list ) -- get o"></a> LISTITEM( index, list ) -- get one element of a list
380
381 - Index is 1 to size of list; use a negative number to count from the end of the list
382 - Syntax: <code>**$LISTITEM( index, list )**</code>
383 - Example: <code>**%CALC\{"$LISTITEM(2, Apple, Orange, Apple, Kiwi)"\}%**</code> returns <code>**Orange**</code>
384 - Example: <code>**%CALC\{"$LISTITEM(-1, Apple, Orange, Apple, Kiwi)"\}%**</code> returns <code>**Kiwi**</code>
385 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
386
387 <a name="FuncLISTMAP"></a>
388
389 ### <a name="LISTMAP( formula, list ) -- eval"></a> LISTMAP( formula, list ) -- evaluate and update each element of a list
390
391 - In the formula you can use <code>**$item**</code> to indicate the element; <code>**$index**</code> to show the index of the list, starting at 1
392 - Syntax: <code>**$LISTMAP( formula, list )**</code>
393 - Example: <code>**%CALC\{"$LISTMAP($index: $EVAL(2 \* $item), 3, 5, 7, 11)"\}%**</code> returns <code>**1: 6, 2: 10, 3: 14, 4: 22**</code>
394 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
395
396 <a name="FuncLISTREVERSE"></a>
397
398 ### <a name="LISTREVERSE( list ) -- opposite"></a><a name="LISTREVERSE( list ) -- opposite "></a> LISTREVERSE( list ) -- opposite order of a list
399
400 - Syntax: <code>**$LISTREVERSE( list )**</code>
401 - Example: <code>**%CALC\{"$LISTREVERSE(Apple, Orange, Apple, Kiwi)"\}%**</code> returns <code>**Kiwi, Apple, Orange, Apple**</code>
402 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
403
404 <a name="FuncLISTSIZE"></a>
405
406 ### <a name="LISTSIZE( list ) -- number of el"></a> LISTSIZE( list ) -- number of elements in a list
407
408 - Syntax: <code>**$LISTSIZE( list )**</code>
409 - Example: <code>**%CALC\{"$LISTSIZE(Apple, Orange, Apple, Kiwi)"\}%**</code> returns <code>**4**</code>
410 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
411
412 <a name="FuncLISTSORT"></a>
413
414 ### <a name="LISTSORT( list ) -- sort a list"></a> LISTSORT( list ) -- sort a list
415
416 - Sorts a list in ASCII order, or numerically if all elements are numeric
417 - Syntax: <code>**$LISTSORT( list )**</code>
418 - Example: <code>**%CALC\{"$LISTSORT(Apple, Orange, Apple, Kiwi)"\}%**</code> returns <code>**Apple, Apple, Kiwi, Orange**</code>
419 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTUNIQUE()|Main/WebHome#FuncLISTUNIQUE]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
420
421 <a name="FuncLISTUNIQUE"></a>
422
423 ### <a name="LISTUNIQUE( list ) -- remove all"></a> LISTUNIQUE( list ) -- remove all duplicates from a list
424
425 - Syntax: <code>**$LISTUNIQUE( list )**</code>
426 - Example: <code>**%CALC\{"$LISTUNIQUE(Apple, Orange, Apple, Kiwi)"\}%**</code> returns <code>**Apple, Orange, Kiwi**</code>
427 - Related: <code>[[$COUNTITEMS()|Main/WebHome#FuncCOUNTITEMS]]</code>, <code>[[$COUNTSTR()|Main/WebHome#FuncCOUNTSTR]]</code>, <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$LISTIF()|Main/WebHome#FuncLISTIF]]</code>, <code>[[$LISTITEM()|Main/WebHome#FuncLISTITEM]]</code>, <code>[[$LISTMAP()|Main/WebHome#FuncLISTMAP]]</code>, <code>[[$LISTREVERSE()|Main/WebHome#FuncLISTREVERSE]]</code>, <code>[[$LISTSIZE()|Main/WebHome#FuncLISTSIZE]]</code>, <code>[[$LISTSORT()|Main/WebHome#FuncLISTSORT]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
428
429 <a name="FuncLOWER"></a>
430
431 ### <a name="LOWER( text ) -- lower case stri"></a> LOWER( text ) -- lower case string of a text
432
433 - Syntax: <code>**$LOWER(text)**</code>
434 - Example: <code>**%CALC\{"$LOWER( $T(R1:C5) )"\}%**</code> returns the lower case string of the text in cell <code>**R1:C5**</code>
435 - Related: <code>[[$PROPER()|Main/WebHome#FuncPROPER]]</code>, <code>[[$PROPERSPACE()|Main/WebHome#FuncPROPERSPACE]]</code>, <code>[[$TRIM()|Main/WebHome#FuncTRIM]]</code>, <code>[[$UPPER()|Main/WebHome#FuncUPPER]]</code>
436
437 <a name="FuncMAX"></a>
438
439 ### <a name="MAX( list ) - biggest value of a"></a> MAX( list ) - biggest value of a list or range of cells
440
441 - Syntax: <code>**$MAX( list )**</code>
442 - Example: To find the biggest number to the left of the current cell, write: <code>**%CALC\{"$MAX($LEFT())"\}%**</code>
443 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$MEDIAN()|Main/WebHome#FuncMEDIAN]]</code>, <code>[[$MIN()|Main/WebHome#FuncMIN]]</code>
444
445 <a name="FuncMEDIAN"></a>
446
447 ### <a name="MEDIAN( list ) -- median of a li"></a> MEDIAN( list ) -- median of a list or range of cells
448
449 - Syntax: <code>**$MEDIAN( list )**</code>
450 - Example: <code>**%CALC\{"$MEDIAN(3, 9, 4, 5)"\}%**</code> returns <code>**4\.5**</code>
451 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$MAX()|Main/WebHome#FuncMAX]]</code>, <code>[[$MIN()|Main/WebHome#FuncMIN]]</code>
452
453 <a name="FuncMIN"></a>
454
455 ### <a name="MIN( list ) -- smallest value of"></a> MIN( list ) -- smallest value of a list or range of cells
456
457 - Syntax: <code>**$MIN( list )**</code>
458 - Example: <code>**%CALC\{"$MIN(15, 3, 28)"\}%**</code> returns <code>**3**</code>
459 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$MAX()|Main/WebHome#FuncMAX]]</code>, <code>[[$MEDIAN()|Main/WebHome#FuncMEDIAN]]</code>
460
461 <a name="FuncMOD"></a>
462
463 ### <a name="MOD( num, divisor ) -- reminder"></a><a name="MOD( num, divisor ) -- reminder "></a> MOD( num, divisor ) -- reminder after dividing <code>**num**</code> by <code>**divisor**</code>
464
465 - Syntax: <code>**$MOD( num, divisor )**</code>
466 - Example: <code>**%CALC\{"$MOD(7, 3)"\}%**</code> returns <code>**1**</code>
467 - Related: <code>[[$EVAL()|Main/WebHome#FuncEVAL]]</code>, <code>[[$()|Main/WebHome#Func]]</code>
468
469 <a name="FuncNOP"></a>
470
471 ### <a name="NOP( text ) -- no-operation"></a> NOP( text ) -- no-operation
472
473 - Useful to change the order of Plugin execution. For example, it allows preprossing to be done before `%SEARCH{}%` is evaluated. The percent character '%' can be escaped with `$per`
474 - Syntax: <code>**$NOP( text )**</code>
475
476 <a name="FuncNOT"></a>
477
478 ### <a name="NOT( num ) -- reverse logic of a"></a> NOT( num ) -- reverse logic of a number
479
480 - Returns 0 if <code>**num**</code> is not zero, 1 if zero
481 - Syntax: <code>**$NOT( num )**</code>
482 - Example: <code>**%CALC\{"$NOT(0)"\}%**</code> returns <code>**1**</code>
483 - Related: <code>[[$AND()|Main/WebHome#FuncAND]]</code>, <code>[[$IF()|Main/WebHome#FuncIF]]</code>, <code>[[$OR()|Main/WebHome#FuncOR]]</code>
484
485 <a name="FuncOR"></a>
486
487 ### <a name="OR( list ) -- logcial OR of a li"></a> OR( list ) -- logcial OR of a list
488
489 - Syntax: <code>**$OR( list )**</code>
490 - Example: <code>**%CALC\{"$OR(1, 0, 1)"\}%**</code> returns <code>**1**</code>
491 - Related: <code>[[$AND()|Main/WebHome#FuncAND]]</code>, <code>[[$IF()|Main/WebHome#FuncIF]]</code>, <code>[[$NOT()|Main/WebHome#FuncNOT]]</code>
492
493 <a name="FuncPRODUCT"></a>
494
495 ### <a name="PRODUCT( list ) -- product of a"></a><a name="PRODUCT( list ) -- product of a "></a> PRODUCT( list ) -- product of a list or range of cells
496
497 - Syntax: <code>**$PRODUCT( list )**</code>
498 - Example: To calculate the product of the cells to the left of the current one use <code>**%CALC\{"$PRODUCT($LEFT())"\}%**</code>
499 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$PRODUCT()|Main/WebHome#FuncPRODUCT]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>, <code>[[$SUMPRODUCT()|Main/WebHome#FuncSUMPRODUCT]]</code>
500
501 <a name="FuncPROPER"></a>
502
503 ### <a name="PROPER( text ) -- properly capit"></a> PROPER( text ) -- properly capitalize trxt
504
505 - Capitalize letters that follow any character other than a letter; convert all other letters to lowercase letters
506 - Syntax: <code>**$PROPER( text )**</code>
507 - Example: <code>**%CALC\{"PROPER(a small STEP)"\}%**</code> returns <code>**A Small Step**</code>
508 - Example: <code>**%CALC\{"PROPER(f1 (formula-1))"\}%**</code> returns <code>**F1 (Formula-1)**</code>
509 - Related: <code>[[$LOWER()|Main/WebHome#FuncLOWER]]</code>, <code>[[$PROPERSPACE()|Main/WebHome#FuncPROPERSPACE]]</code>, <code>[[$TRIM()|Main/WebHome#FuncTRIM]]</code>, <code>[[$UPPER()|Main/WebHome#FuncUPPER]]</code>
510
511 <a name="FuncPROPERSPACE"></a>
512
513 ### <a name="PROPERSPACE( text ) -- properly"></a><a name="PROPERSPACE( text ) -- properly "></a> PROPERSPACE( text ) -- properly space out WikiWords
514
515 - Properly spaces out [[WikiWords]] preceeded by white space, parenthesis, or <code>**]\[**</code>. Words listed in the DONTSPACE [[TWikiPreferences]] variable or DONTSPACE Plugins setting are excluded
516 - Syntax: <code>**$PROPERSPACE( text )**</code>
517 - Example: Assuming DONTSPACE contains MacDonald: <code>**%CALC\{"PROPERSPACE(Old MacDonald had a ServerFarm, EeEyeEeEyeOh"\}%**</code> returns <code>**Old MacDonald had a Server Farm, Ee Eye Ee Eye Oh**</code>
518 - Related: <code>[[$LOWER()|Main/WebHome#FuncLOWER]]</code>, <code>[[$PROPER()|Main/WebHome#FuncPROPER]]</code>, <code>[[$TRIM()|Main/WebHome#FuncTRIM]]</code>, <code>[[$UPPER()|Main/WebHome#FuncUPPER]]</code>
519
520 <a name="FuncRAND"></a>
521
522 ### <a name="RAND( max ) -- random number"></a> RAND( max ) -- random number
523
524 - Random number, evenly distributed between 0 and <code>**max**</code>, or 0 and 1 if max is not specified
525 - Syntax: <code>**$RAND( max )**</code>
526 - Related: <code>[[$EVAL()|Main/WebHome#FuncEVAL]]</code>
527
528 <a name="FuncREPEAT"></a>
529
530 ### <a name="REPEAT(text) -- repeat text a nu"></a> REPEAT(text) -- repeat text a number of times
531
532 - Syntax: <code>**$REPEAT( text )**</code>
533 - Example: <code>**%CALC\{"$REPEAT(/\\, 5)"\}%**</code> returns <code>**/\\/\\/\\/\\/\\**</code>
534
535 <a name="FuncREPLACE"></a>
536
537 ### <a name="REPLACE( text, start, num, new )"></a> REPLACE( text, start, num, new ) -- replace part of a text string
538
539 - Replace `num` number of characters of text string `text`, starting at `start`, with new text `new`. Starting position is 1; use a negative `start` to count from the end of the text
540 - Syntax: <code>**$REPLACE( text, start, num, new )**</code>
541 - Example: <code>**%CALC\{"$REPLACE(abcdefghijk,6,5,\*)"\}%**</code> returns <code>**abcde\*k**</code>
542 - Related: <code>[[$FIND()|Main/WebHome#FuncFIND]]</code>, <code>[[$SEARCH()|Main/WebHome#FuncSEARCH]]</code>, <code>[[$SUBSTITUTE()|Main/WebHome#FuncSUBSTITUTE]]</code>, <code>[[$TRANSLATE()|Main/WebHome#FuncTRANSLATE]]</code>
543
544 <a name="FuncRIGHT"></a>
545
546 ### <a name="RIGHT( ) -- address range of cel"></a> RIGHT( ) -- address range of cells to the right of the current cell
547
548 - Syntax: <code>**$RIGHT( )**</code>
549 - Example: <code>**%CALC\{"$SUM($RIGHT())"\}%**</code> returns the sum of cells to the right of the current cell
550 - Related: <code>[[$ABOVE()|Main/WebHome#FuncABOVE]]</code>, <code>[[$LEFT()|Main/WebHome#FuncLEFT]]</code>
551
552 <a name="FuncROUND"></a>
553
554 ### <a name="ROUND( formula, digits ) -- roun"></a> ROUND( formula, digits ) -- round a number
555
556 - Evaluates a simple <code>**formula**</code> and rounds the result up or down to the number of digits if <code>**digits**</code> is positive; to the nearest integer if digits is missing; or to the left of the decimal point if digits is negative
557 - Syntax: <code>**$ROUND( formula, digits )**</code>
558 - Example: <code>**%CALC\{"$ROUND(3.15, 1)"\}%**</code> returns <code>**3\.2**</code>
559 - Example: <code>**%CALC\{"$ROUND(3.149, 1)"\}%**</code> returns <code>**3\.1**</code>
560 - Example: <code>**%CALC\{"$ROUND(-2.475, 2)"\}%**</code> returns <code>**-2.48**</code>
561 - Example: <code>**%CALC\{"$ROUND(34.9, -1)"\}%**</code> returns <code>**30**</code>
562 - Related: <code>[[$INT()|Main/WebHome#FuncINT]]</code>, <code>[[$FORMAT()|Main/WebHome#FuncFORMAT]]</code>
563
564 <a name="FuncROW"></a>
565
566 ### <a name="ROW( offset ) -- current row num"></a> ROW( offset ) -- current row number
567
568 - The current table row number with an optional offset
569 - Syntax: <code>**$ROW( _offset_ )**</code>
570 - Example: To get the number of rows excluding table heading (first row) and summary row (last row you are in), write: <code>**%CALC\{"$ROW(-2)"\}%**</code>
571 - Related: <code>[[$COLUMN()|Main/WebHome#FuncCOLUMN]]</code>, <code>[[$T()|Main/WebHome#FuncT]]</code>
572
573 <a name="FuncSEARCH"></a>
574
575 ### <a name="SEARCH( string, text, start ) --"></a> SEARCH( string, text, start ) -- search a string within a text
576
577 - Finds one text `string`, within another `text`, and returns the number of the starting position of `string`, from the first character of `text`. This search is a [[RegularExpression]] search; use `$FIND()` for non-regular expression searching. Starting position is 1; a 0 is returned if nothing is matched
578 - Syntax: <code>**$SEARCH( string, text, _start_ )**</code>
579 - Example: <code>**%CALC\{"$SEARCH([uy], fluffy)"\}%**</code> returns <code>**3**</code>
580 - Example: <code>**%CALC\{"$SEARCH([uy], fluffy, 3)"\}%**</code> returns <code>**6**</code>
581 - Example: <code>**%CALC\{"$SEARCH([abc], fluffy,)"\}%**</code> returns <code>****</code>
582 - Related: <code>[[$FIND()|Main/WebHome#FuncFIND]]</code>, <code>[[$REPLACE()|Main/WebHome#FuncREPLACE]]</code>
583
584 <a name="FuncSET"></a>
585
586 ### <a name="SET( name, value ) -- set a vari"></a> SET( name, value ) -- set a variable for later use
587
588 - 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
589 - Syntax: <code>**$SET( name, value )**</code>
590 - Example: <code>**%CALC\{"$SET(my\_total, $SUM($ABOVE()))"\}%**</code> sets the `my_total` variable to the sum of all table cells located above the current cell and returns an empty string
591 - Related: <code>[[$GET()|Main/WebHome#FuncGET]]</code>, <code>[[SETM()|Main/WebHome#FuncSETM]]</code>
592
593 <a name="FuncSETM"></a>
594
595 ### <a name="SETM( name, formula ) -- update"></a><a name="SETM( name, formula ) -- update "></a> SETM( name, formula ) -- update an existing variable based on a formula
596
597 - Specify the variable name (alphanumeric characters and underscores) and the formula. The formula must start with an operator to <code>**+**</code> (add), <code>**-**</code> (subtract), <code>**\***</code> (multiply), or <code>**/**</code> (divide) something to the variable. This function returns no output. Use `$GET()` to retrieve variables
598 - Syntax: <code>**$SETM( name, formula )**</code>
599 - Example: <code>**%CALC\{"$SETM(total, + $SUM($LEFT()))"\}%**</code> adds the sum of all table cells on the left to the `total` variable, and returns an empty string
600 - Related: <code>[[$GET()|Main/WebHome#FuncGET]]</code>, <code>[[$SET()|Main/WebHome#FuncSET]]</code>
601
602 <a name="FuncSIGN"></a>
603
604 ### <a name="SIGN( num ) -- sign of a number"></a> SIGN( num ) -- sign of a number
605
606 - Returns -1 if <code>**num**</code> is negative, 0 if zero, or 1 if positive
607 - Syntax: <code>**$SIGN( num )**</code>
608 - Example: <code>**%CALC\{"$SIGN(-12.5)"\}%**</code> returns <code>**-1**</code>
609 - Related: <code>[[$ABS()|Main/WebHome#FuncABS]]</code>, <code>[[$EVAL()|Main/WebHome#FuncEVAL]]</code>, <code>[[$INT()|Main/WebHome#FuncINT]]</code>, <code>[[$NOT()|Main/WebHome#FuncNOT]]</code>
610
611 <a name="FuncSUBSTITUTE"></a>
612
613 ### <a name="SUBSTITUTE( text, old, new, inst"></a> SUBSTITUTE( text, old, new, instance, option ) -- substitute text
614
615 - 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 [[RegularExpression]] search if the `option` is set to <code>**r**</code>
616 - Syntax: <code>**$SUBSTITUTE( text, old, _new_, _instance_, _option_ )**</code>
617 - Example: <code>**%CALC\{"$SUBSTITUTE(Good morning, morning, day)"\}%**</code> returns <code>**Good day**</code>
618 - Example: <code>**%CALC\{"$SUBSTITUTE(Q2-2002,2,3)"\}%**</code> returns <code>**Q3-3003**</code>
619 - Example: <code>**%CALC\{"$SUBSTITUTE(Q2-2002,2,3,3)"\}%**</code> returns <code>**Q2-2003**</code>
620 - Example: <code>**%CALC\{"$SUBSTITUTE(abc123def,[0-9],9,,r)"\}%**</code> returns <code>**abc999def**</code>
621 - Related: <code>[[$REPLACE()|Main/WebHome#FuncREPLACE]]</code>, <code>[[$TRANSLATE()|Main/WebHome#FuncTRANSLATE]]</code>
622
623 <a name="FuncSUM"></a>
624
625 ### <a name="SUM( list ) -- sum of a list or"></a><a name="SUM( list ) -- sum of a list or "></a> SUM( list ) -- sum of a list or range of cells
626
627 - Syntax: <code>**$SUM( list )**</code>
628 - Example: To sum up column 5 excluding the title row, write <code>**%CALC\{"$SUM(R2:C5..R$ROW(-1):C5)"\}%**</code> in the last row; or simply <code>**%CALC\{"$SUM($ABOVE())"\}%**</code>
629 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$PRODUCT()|Main/WebHome#FuncPRODUCT]]</code>, <code>[[$SUMPRODUCT()|Main/WebHome#FuncSUMPRODUCT]]</code>, <code>[[$WORKINGDAYS()|Main/WebHome#FuncWORKINGDAYS]]</code>
630
631 <a name="FuncSUMDAYS"></a>
632
633 ### <a name="SUMDAYS( list ) -- sum the days"></a><a name="SUMDAYS( list ) -- sum the days "></a> SUMDAYS( list ) -- sum the days in a list or range of cells
634
635 - 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 <code>**h**</code>, <code>**hours**</code>, <code>**d**</code>, <code>**days**</code>, <code>**w**</code>, <code>**weeks**</code> suffix. One week is assumed to have 5 working days, one day 8 hours
636 - Syntax: <code>**$SUMDAYS( list )**</code>
637 - Example: <code>**%CALC\{"$SUMDAYS(2w, 1, 2d, 4h)"\}%**</code> returns <code>**13\.5**</code>, the evaluation of `(2*5 + 1 + 2 + 4/8)`
638 - Related: <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$FORMATTIME()|Main/WebHome#FuncFORMATTIME]]</code>
639
640 <a name="FuncSUMPRODUCT"></a>
641
642 ### <a name="SUMPRODUCT( list, list ) -- scal"></a> SUMPRODUCT( list, list ) -- scalar product on ranges of cells
643
644 - Syntax: <code>**$SUMPRODUCT( list, list, _list..._ )**</code>
645 - Example: <code>**%CALC\{"$SUM(R2:C1..R4:C1, R2:C5..R4:C5)"\}%**</code> evaluates and returns the result of <code>**($T(R2:C1) \* $T(R2:C5) + $T(R3:C1) \* $T(R3:C5) + $T(R4:C1) \* $T(R4:C5))**</code>
646 - Related: <code>[[$LIST()|Main/WebHome#FuncLIST]]</code>, <code>[[$PRODUCT()|Main/WebHome#FuncPRODUCT]]</code>, <code>[[$SUM()|Main/WebHome#FuncSUM]]</code>
647
648 <a name="FuncT"></a>
649
650 ### <a name="T( address ) -- content of a cel"></a> T( address ) -- content of a cell
651
652 - Syntax: <code>**$T( address )**</code>
653 - Example: <code>**%CALC\{"$T(R1:C5)"\}%**</code> returns the text in cell <code>**R1:C5**</code>
654 - Related: <code>[[$COLUMN()|Main/WebHome#FuncCOLUMN]]</code>, <code>[[$ROW()|Main/WebHome#FuncROW]]</code>
655
656 <a name="FuncTRANSLATE"></a>
657
658 ### <a name="TRANSLATE( text, from, to ) -- t"></a> TRANSLATE( text, from, to ) -- translate text from one set of characters to another
659
660 - The translation is done `from` a set `to` a set, one character by one. The `text` may contain commas; all three parameters are required. In the `from` and `to` parameters you can write `$comma` to escape comma, `$sp` to escape space
661 - Syntax: <code>**$TRANSLATE( text, from, to )**</code>
662 - Example: <code>**%CALC\{"$TRANSLATE(boom,bm,cl)"\}%**</code> returns <code>**cool**</code>
663 - Example: <code>**%CALC\{"$TRANSLATE(one, two,$comma,;)"\}%**</code> returns <code>**one; two**</code>
664 - Related: <code>[[$REPLACE()|Main/WebHome#FuncREPLACE]]</code>, <code>[[$SUBSTITUTE()|Main/WebHome#FuncSUBSTITUTE]]</code>
665
666 <a name="FuncTIME"></a>
667
668 ### <a name="TIME( text ) -- convert a date s"></a> TIME( text ) -- convert a date string into a serialized date number
669
670 - Serialized date is 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
671 - Syntax: <code>**$TIME( _text_ )**</code>
672 - Example: <code>**%CALC\{"$TIME(2003/10/14 GMT)"\}%**</code> returns <code>**1066089600**</code>
673 - Related: <code>[[$FORMATTIME()|Main/WebHome#FuncFORMATTIME]]</code>, <code>[[$FORMATGMTIME()|Main/WebHome#FuncFORMATGMTIME]]</code>, <code>[[$TIMEADD()|Main/WebHome#FuncTIMEADD]]</code>, <code>[[$TIMEDIFF()|Main/WebHome#FuncTIMEDIFF]]</code>, <code>[[$TODAY()|Main/WebHome#FuncTODAY]]</code>, <code>[[$WORKINGDAYS()|Main/WebHome#FuncWORKINGDAYS]]</code>
674
675 <a name="FuncTIMEADD"></a>
676
677 ### <a name="TIMEADD( serial, value, unit ) -"></a> TIMEADD( serial, value, unit ) -- add a value to a serialized date
678
679 - 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
680 - Syntax: <code>**$TIMEADD( serial, value, _unit_ )**</code>
681 - Example: <code>**%CALC\{"$TIMEADD($TIME(), 2, week)"\}%**</code>
682 - Related: <code>[[$()|Main/WebHome#Func]]</code>, <code>[[$()|Main/WebHome#Func]]</code> returns the serialized date two weeks from now
683 - Related: <code>[[$FORMATTIME()|Main/WebHome#FuncFORMATTIME]]</code>, <code>[[$FORMATGMTIME()|Main/WebHome#FuncFORMATGMTIME]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$TIMEDIFF()|Main/WebHome#FuncTIMEDIFF]]</code>, <code>[[$TODAY()|Main/WebHome#FuncTODAY]]</code>
684
685 <a name="FuncTIMEDIFF"></a>
686
687 ### <a name="TIMEDIFF( serial_1, serial_2, un"></a> TIMEDIFF( serial\_1, serial\_2, unit ) -- time difference between two serialized dates
688
689 - 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
690 - Syntax: <code>**$TIMEDIFF( serial\_1, serial\_2, _unit_ )**</code>
691 - Example: <code>**%CALC\{"$TIMEDIFF($TIME(), $EVAL($TIME()+90), minute)"\}%**</code> returns <code>**1\.5**</code>
692 - Related: <code>[[$FORMAT()|Main/WebHome#FuncFORMAT]]</code>, <code>[[$FORMATTIME()|Main/WebHome#FuncFORMATTIME]]</code>, <code>[[$FORMATGMTIME()|Main/WebHome#FuncFORMATGMTIME]]</code>, <code>[[$INT()|Main/WebHome#FuncINT]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$TIMEADD()|Main/WebHome#FuncTIMEADD]]</code>, <code>[[$TODAY()|Main/WebHome#FuncTODAY]]</code>, <code>[[$WORKINGDAYS()|Main/WebHome#FuncWORKINGDAYS]]</code>
693
694 <a name="FuncTODAY"></a>
695
696 ### <a name="TODAY( ) -- serialized date of t"></a> TODAY( ) -- serialized date of today at midnight GMT
697
698 - In contrast, the related `$TIME()` returns the serialized date of today at the current time, e.g. it includes the number of seconds since midnight GMT
699 - Syntax: <code>**$TODAY( )**</code>
700 - Example: <code>**%CALC\{"$TODAY()"\}%**</code> returns the number of seconds since Epoch
701 - Related: <code>[[$FORMATTIME()|Main/WebHome#FuncFORMATTIME]]</code>, <code>[[$FORMATGMTIME()|Main/WebHome#FuncFORMATGMTIME]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$TIMEADD()|Main/WebHome#FuncTIMEADD]]</code>, <code>[[$TIMEDIFF()|Main/WebHome#FuncTIMEDIFF]]</code>
702
703 <a name="FuncTRIM"></a>
704
705 ### <a name="TRIM( text ) -- trim spaces from"></a> TRIM( text ) -- trim spaces from text
706
707 - Removes all spaces from text except for single spaces between words
708 - Syntax: <code>**$TRIM( text )**</code>
709 - Example: <code>**%CALC\{"$TRIM( eat  spaces  )"\}%**</code> returns <code>**eat spaces**</code>
710 - Related: <code>[[$EXACT()|Main/WebHome#FuncEXACT]]</code>, <code>[[$PROPERSPACE()|Main/WebHome#FuncPROPERSPACE]]</code>
711
712 <a name="FuncUPPER"></a>
713
714 ### <a name="UPPER( text ) -- upper case stri"></a> UPPER( text ) -- upper case string of a text
715
716 - Syntax: <code>**$UPPER( text )**</code>
717 - Example: <code>**%CALC\{"$UPPER($T(R1:C5))"\}%**</code> returns the upper case string of the text in cell <code>**R1:C5**</code>
718 - Related: <code>[[$LOWER()|Main/WebHome#FuncLOWER]]</code>, <code>[[$PROPER()|Main/WebHome#FuncPROPER]]</code>, <code>[[$PROPERSPACE()|Main/WebHome#FuncPROPERSPACE]]</code>, <code>[[$TRIM()|Main/WebHome#FuncTRIM]]</code>
719
720 <a name="FuncVALUE"></a>
721
722 ### <a name="VALUE( text ) -- convert text to"></a> VALUE( text ) -- convert text to number
723
724 - Extracts a number from <code>**text**</code>. Returns <code>****</code> if not found
725 - Syntax: <code>**$VALUE( text )**</code>
726 - Example: <code>**%CALC\{"$VALUE(US$1,200)"\}%**</code> returns <code>**1200**</code>
727 - Example: <code>**%CALC\{"$VALUE(PrjNotebook1234)"\}%**</code> returns <code>**1234**</code>
728 - Example: <code>**%CALC\{"$VALUE(Total: -12.5)"\}%**</code> returns <code>**-12.5**</code>
729 - Related: <code>[[$EVAL()|Main/WebHome#FuncEVAL]]</code>, <code>[[$INT()|Main/WebHome#FuncINT]]</code>
730
731 <a name="FuncWORKINGDAYS"></a>
732
733 ### <a name="WORKINGDAYS( serial_1, serial_2"></a><a name="WORKINGDAYS( serial_1, serial_2 "></a> WORKINGDAYS( serial\_1, serial\_2 ) -- working days between two serialized dates
734
735 - Working days are Monday through Friday (sorry, Israel!)
736 - Syntax: <code>**$WORKINGDAYS( serial\_1, serial\_2 )**</code>
737 - Example: <code>**%CALC\{"$WORKINGDAYS($TIME(2004/07/15), $TIME(2004/08/03))"\}%**</code> returns <code>**13**</code>
738 - Related: <code>[[$SUMDAYS()|Main/WebHome#FuncSUMDAYS]]</code>, <code>[[$TIME()|Main/WebHome#FuncTIME]]</code>, <code>[[$TIMEDIFF()|Main/WebHome#FuncTIMEDIFF]]</code>
739
740 ## <a name="Bug Tracking Example"></a> Bug Tracking Example
741
742 <table border="1" cellpadding="0" cellspacing="0">
743   <tr>
744     <th bgcolor="#99CCCC"><strong> Bug#: </strong></th>
745     <th bgcolor="#99CCCC"><strong> Priority: </strong></th>
746     <th bgcolor="#99CCCC"><strong> Subject: </strong></th>
747     <th bgcolor="#99CCCC"><strong> Status: </strong></th>
748     <th bgcolor="#99CCCC"><strong> Days to fix </strong></th>
749   </tr>
750   <tr>
751     <td> Bug:1231 </td>
752     <td> Low </td>
753     <td> File Open ... </td>
754     <td> Open </td>
755     <td align="right"> 3 </td>
756   </tr>
757   <tr>
758     <td> Bug:1232 </td>
759     <td> High </td>
760     <td> Memory Window ... </td>
761     <td> Fixed </td>
762     <td align="right"> 2 </td>
763   </tr>
764   <tr>
765     <td> Bug:1233 </td>
766     <td> Medium </td>
767     <td> Usability issue ... </td>
768     <td> Assigned </td>
769     <td align="right"> 5 </td>
770   </tr>
771   <tr>
772     <td> Bug:1234 </td>
773     <td> High </td>
774     <td> No arrange ... </td>
775     <td> Fixed </td>
776     <td align="right"> 1 </td>
777   </tr>
778   <tr>
779     <td> Total: 4 </td>
780     <td> High: 2<br /> Low: 1<br /> Medium: 1 </td>
781     <td> . </td>
782     <td> Assigned: 1<br /> Fixed: 2<br /> Open: 1 </td>
783     <td align="right"> Total: 11 </td>
784   </tr>
785 </table>
786
787 The last row is defined as:
788
789     | Total: %CALC{"$ROW(-2)"}% \
790       | %CALC{"$COUNTITEMS( R2:C$COLUMN()..R$ROW(-1):C$COLUMN() )"}% | . \
791       | %CALC{"$COUNTITEMS( R2:C$COLUMN()..R$ROW(-1):C$COLUMN() )"}% \
792       |  Total: %CALC{"$SUM( R2:C$COLUMN()..R$ROW(-1):C$COLUMN() )"}% |
793
794 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.
795
796 ## <a name="Plugin Settings"></a> Plugin Settings
797
798 Plugin settings are stored as preferences variables. To reference a plugin setting write <code>**%&lt;plugin&gt;\_&lt;setting&gt;%**</code>, i.e. <code>**%SPREADSHEETPLUGIN\_SHORTDESCRIPTION%**</code>
799
800 - One line description, is shown in the [[TextFormattingRules]] topic:
801   - Set SHORTDESCRIPTION = Add spreadsheet calculation like `"$SUM( $ABOVE() )"` to tables located in %WIKITOOLNAME% topics.
802
803 - Debug plugin: (See output in `data/debug.txt`)
804   - Set DEBUG = 0
805
806 - Do not handle `%CALC{}%` tag in included topic while including topic: (default: 1)
807   - Set SKIPINCLUDE = 1
808
809 - [[WikiWords|TWiki/WikiWord]] to exclude from being spaced out by the <code>**$PROPERSPACE(text)**</code> function. This comma delimited list can be overloaded by a DONTSPACE preferences variable:
810   - Set DONTSPACE = CodeWarrior, MacDonald, McIntosh, RedHat, SuSE
811
812 ## <a name="Plugin Installation Instructions"></a> Plugin Installation Instructions
813
814 **_Note:_** You do not need to install anything on the browser to use this plugin. Below installation instructions are for the administrator who needs to install this plugin on the TWiki server.
815
816 - Download the ZIP file from the %TOPIC% home
817 - Unzip <code>**SpreadSheetPlugin.zip**</code> in your twiki installation directory. Content: <table border="1" cellpadding="0" cellspacing="0">
818   <tr>
819     <th bgcolor="#99CCCC"><strong> File: </strong></th>
820     <th bgcolor="#99CCCC"><strong> Description: </strong></th>
821   </tr>
822   <tr>
823     <td><code><b>data/TWiki/%TOPIC%.txt</b></code></td>
824     <td> Plugin topic </td>
825   </tr>
826   <tr>
827     <td><code><b>data/TWiki/%TOPIC%.txt,v</b></code></td>
828     <td> Plugin topic repository </td>
829   </tr>
830   <tr>
831     <td><code><b>lib/TWiki/Plugins/%TOPIC%.pm</b></code></td>
832     <td> Plugin Perl module </td>
833   </tr>
834 </table>
835 - Test if the "Total" in the first table in this topic is correct.
836
837 ## <a name="Plugin Info"></a> Plugin Info
838
839 <table border="1" cellpadding="0" cellspacing="0">
840   <tr>
841     <td align="right"> Plugin Author: </td>
842     <td> TWiki:Main/PeterThoeny </td>
843   </tr>
844   <tr>
845     <td align="right"> Plugin Version: </td>
846     <td> 17 Jul 2004 </td>
847   </tr>
848   <tr>
849     <td align="right"> Change History: </td>
850     <td>  </td>
851   </tr>
852   <tr>
853     <td align="right"> 17 Jul 2004: </td>
854     <td> Added $WORKINGDAYS(), contributed by TWiki:Main/CrawfordCurrie </td>
855   </tr>
856   <tr>
857     <td align="right"> 24 May 2004: </td>
858     <td> Refactored documentation (no code changes) </td>
859   </tr>
860   <tr>
861     <td align="right"> 03 Apr 2004: </td>
862     <td> Added $ABS(), $LISTIF(); fixed $VALUE() to remove leading zeros; changed $FIND() and $SEARCH() to return 0 instead of empty string if no match </td>
863   </tr>
864   <tr>
865     <td align="right"> 21 Mar 2004: </td>
866     <td> Added $LISTITEM(); fixed call to unofficial function </td>
867   </tr>
868   <tr>
869     <td align="right"> 16 Mar 2004: </td>
870     <td> Added $LISTMAP(), $LISTREVERSE(), $LISTSIZE(), $LISTSORT(), $LISTUNIQUE(), $SETM(); retired $COUNTUNIQUE() in favor of $COUNTITEMS($LISTUNIQUE()); fixed evaluation order issue of $IF(); fixed missing eval error messages suppressed since version 06 Mar 2004; redirect stderr messages to warning </td>
871   </tr>
872   <tr>
873     <td align="right"> 08 Mar 2004: </td>
874     <td> Added $LIST() </td>
875   </tr>
876   <tr>
877     <td align="right"> 06 Mar 2004: </td>
878     <td> Added $AND(), $MOD(), $NOT(), $OR(), $PRODUCT(), $PROPER(), $PROPERSPACE(), $RAND(), $REPEAT(), $SIGN(), $VALUE(); added digits parameter to $ROUND(); renamed $MULT() to $PRODUCT(); $MULT() is deprecated and undocumented </td>
879   </tr>
880   <tr>
881     <td align="right"> 27 Feb 2004: </td>
882     <td> Added $COUNTUNIQUE() </td>
883   </tr>
884   <tr>
885     <td align="right"> 24 Oct 2003: </td>
886     <td> Added $SET(), $GET(), $MEDIAN(); added $SUMPRODUCT(), inspired by TWiki:Main/RobertWithrow; added $SUMDAYS(), contributed by TWiki:Main/SvenDowideit </td>
887   </tr>
888   <tr>
889     <td align="right"> 21 Oct 2003: </td>
890     <td> Added support for lists <code>(1, 2, 3)</code> and lists of table ranges <code>(R1:C1..R1:C5, R3:C1..R3:C5)</code> for all functions that accept a table range; added $TIMEADD(); in $TIMEDIFF() added week unit; in $FORMATTIME() changed $weekday to $wd and added $wday and $weekday </td>
891   </tr>
892   <tr>
893     <td align="right"> 14 Oct 2003: </td>
894     <td> Added $TIME(), $TODAY(), $FORMATTIME(), $FORMATGMTIME(), $TIMEDIFF() </td>
895   </tr>
896   <tr>
897     <td align="right"> 13 Oct 2003: </td>
898     <td> Added $MULT(), contributed by TWiki:Main/GerritJanBaarda </td>
899   </tr>
900   <tr>
901     <td align="right"> 30 Jul 2003: </td>
902     <td> Added $TRANSLATE() </td>
903   </tr>
904   <tr>
905     <td align="right"> 19 Jul 2003: </td>
906     <td> Added $FIND(), $NOP(), $REPLACE(), $SEARCH(), $SUBSTITUTE(), contributed by TWiki:Main/PaulineCheung </td>
907   </tr>
908   <tr>
909     <td align="right"> 19 Apr 2003: </td>
910     <td> Added $COUNTSTR(), $EXACT(), $IF(), $ROUND(), $TRIM(); added $FORMAT(), contributed by TWiki:Main/JimStraus; support <code>%</code> modulus operator in $EVAL, $INT, and $ROUND; fixed bug in $DEF </td>
911   </tr>
912   <tr>
913     <td align="right"> 07 Jun 2002: </td>
914     <td> Added $DEF(), contributed by TWiki:Main/MartinFuzzey; allow values with HTML formatting like <code>&lt;u&gt;102&lt;/u&gt;</code>, suggested by TWiki:Main/GladeDiviney; added SKIPINCLUDE setting </td>
915   </tr>
916   <tr>
917     <td align="right"> 12 Mar 2002: </td>
918     <td> Support for multiple functions per nesting level </td>
919   </tr>
920   <tr>
921     <td align="right"> 15 Jan 2002: </td>
922     <td> Added $CHAR(), $CODE() and $LENGTH() </td>
923   </tr>
924   <tr>
925     <td align="right"> 12 Nov 2001: </td>
926     <td> Added $RIGHT() </td>
927   </tr>
928   <tr>
929     <td align="right"> 12 Aug 2001: </td>
930     <td> Fixed bug of disappearing multi-column cells </td>
931   </tr>
932   <tr>
933     <td align="right"> 19 Jul 2001: </td>
934     <td> Fixed incorrect $SUM calculation of cell with value <code>0</code></td>
935   </tr>
936   <tr>
937     <td align="right"> 14 Jul 2001: </td>
938     <td> Changed to plug &amp; play </td>
939   </tr>
940   <tr>
941     <td align="right"> 01 Jun 2001: </td>
942     <td> Fixed insecure dependencies for $MIN and $MAX </td>
943   </tr>
944   <tr>
945     <td align="right"> 16 Apr 2001: </td>
946     <td> Fixed div by 0 bug in $AVERAGE </td>
947   </tr>
948   <tr>
949     <td align="right"> 17 Mar 2001: </td>
950     <td> Initial version </td>
951   </tr>
952   <tr>
953     <td align="right"> CPAN Dependencies: </td>
954     <td> none </td>
955   </tr>
956   <tr>
957     <td align="right"> TWiki:Plugins/Benchmark: </td>
958     <td>[[TWiki/GoodStyle]] 99%, [[TWiki/FormattedSearch]] 99%, %TOPIC% 95% </td>
959   </tr>
960   <tr>
961     <td align="right"> Other Dependencies: </td>
962     <td> none </td>
963   </tr>
964   <tr>
965     <td align="right"> Perl Version: </td>
966     <td> 5.000 and up </td>
967   </tr>
968   <tr>
969     <td align="right"> Plugin Home: </td>
970     <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%</a></td>
971   </tr>
972   <tr>
973     <td align="right"> Feedback: </td>
974     <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev</a></td>
975   </tr>
976 </table>
977
978 **_Related Topics:_** [[TWikiPreferences]], [[TWikiPlugins]]
979
980 -- TWiki:Main/PeterThoeny - 17 Jul 2004