]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FSpreadsheet
Wikicreole syntax
[SourceForge/phpwiki.git] / pgsrc / Help%2FSpreadsheet
1 Date: Fri, 10 Sep 2010 13:46:13 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC1)
3 X-Rcs-Id: $Id$
4 Content-Type: application/x-phpwiki;
5   pagename=Help%2FSpreadsheet;
6   flags=PAGE_LOCKED%2CEXTERNAL_PAGE;
7   markup=2;
8   charset=UTF-8
9 Content-Transfer-Encoding: binary
10
11 Phpwiki has extented the [[Help:Wikicreole|Wikicreole]] syntax of tables so that some simple
12 spreadsheet-like calculations can be performed in tables.
13
14 == Syntax ==
15
16 Five functions are available: SUM, AVERAGE, MAX, MIN and COUNT.
17
18 They operate on the current row (R) or column (C).
19
20 The function is placed in the cell surrounded by ##@@##.
21 Other wiki text can be placed in the cell, but there can be only one formula per cell.
22
23 {| class="bordered"
24 |-
25 ! Formula !! Meaning
26 |-
27 | @@=SUM(R)@@ || Sum of cells in current row
28 |-
29 | @@=SUM(C)@@ || Sum of cells in current column
30 |-
31 | @@=AVERAGE(R)@@ || Average of cells in current row
32 |-
33 | @@=AVERAGE(C)@@ || Average of cells in current column
34 |-
35 | @@=MAX(R)@@ || Maximum value of cells in current row
36 |-
37 | @@=MAX(C)@@ || Maximum value of cells in current column
38 |-
39 | @@=MIN(R)@@ || Minimum value of cells in current row
40 |-
41 | @@=MIN(C)@@ || Minimum value of cells in current column
42 |-
43 | @@=COUNT(R)@@
44 | Number of cells in current row (numeric or not, excluding headers and current cell)
45 |-
46 | @@=COUNT(C)@@
47 | Number of cells in current column (numeric or not, excluding headers and current cell)
48 |}
49
50 == Examples ==
51
52 === Sum ===
53
54 {{{
55 |=Region          |=Telecom Sales  |=Power Sales |=Other       |=TOTAL      |
56 |=Europe          |            320 |          80 |         120 |@@=SUM(R)@@ |
57 |=Asia            |            580 |         723 |         564 |@@=SUM(R)@@ |
58 |=North America   |            235 |          60 |         109 |@@=SUM(R)@@ |
59 |=South America   |            120 |          35 |          82 |@@=SUM(R)@@ |
60 |=Antarctica      |              0 |           0 |          12 |@@=SUM(R)@@ |
61 |=TOTAL           |    @@=SUM(C)@@ | @@=SUM(C)@@ | @@=SUM(C)@@ |Grand total: @@=SUM(R)@@ |
62 }}}
63
64 |=Region          |=Telecom Sales  |=Power Sales |=Other       |=TOTAL      |
65 |=Europe          |            320 |          80 |         120 |@@=SUM(R)@@ |
66 |=Asia            |            580 |         723 |         564 |@@=SUM(R)@@ |
67 |=North America   |            235 |          60 |         109 |@@=SUM(R)@@ |
68 |=South America   |            120 |          35 |          82 |@@=SUM(R)@@ |
69 |=Antarctica      |              0 |           0 |          12 |@@=SUM(R)@@ |
70 |=TOTAL           |    @@=SUM(C)@@ | @@=SUM(C)@@ | @@=SUM(C)@@ |Grand total: @@=SUM(R)@@ |
71
72 Total of both colums and rows is calculated automatically by wiki.
73
74 === Count and Sum ===
75
76 {{{
77 |=Bug                |=Priority   |=Subject             |=Status     |=Days to fix
78 | 1231               | Low        | File Open ...       | Open       | 3
79 | 1232               | High       | Memory Window ...   | Fixed      | 2
80 | 1233               | Medium     | Usability issue ... | Assigned   | 5
81 | 1234               | High       | No arrange ...      | Fixed      | 1
82 | Number of bugs: @@=COUNT(C)@@ | |                     |            | Total: @@=SUM(C)@@ days
83 }}}
84
85 |=Bug                |=Priority   |=Subject             |=Status     |=Days to fix
86 | 1231               | Low        | File Open ...       | Open       | 3
87 | 1232               | High       | Memory Window ...   | Fixed      | 2
88 | 1233               | Medium     | Usability issue ... | Assigned   | 5
89 | 1234               | High       | No arrange ...      | Fixed      | 1
90 | Number of bugs: @@=COUNT(C)@@ | |                     |            | Total: @@=SUM(C)@@ days
91
92 === Min, Max and Average ===
93
94 {{{
95 |=Location            |=Morning     |=Noon        |=Evening     |=Average temperature |
96 | Paris               | 7           | 13          | 10          | @@=AVERAGE(R)@@     |
97 | London              | 3           | 10          | 8           | @@=AVERAGE(R)@@     |
98 | Berlin              | 9           | 15          | 12          | @@=AVERAGE(R)@@     |
99 | Tokyo               | 12          | 20          | 16          | @@=AVERAGE(R)@@     |
100 | Maximum temperature | @@=MAX(C)@@ | @@=MAX(C)@@ | @@=MAX(C)@@ |                     |
101 | Minimum temperature | @@=MIN(C)@@ | @@=MIN(C)@@ | @@=MIN(C)@@ |                     |
102 }}}
103
104 |=Location            |=Morning     |=Noon        |=Evening     |=Average temperature |
105 | Paris               | 7           | 13          | 10          | @@=AVERAGE(R)@@     |
106 | London              | 3           | 10          | 8           | @@=AVERAGE(R)@@     |
107 | Berlin              | 9           | 15          | 12          | @@=AVERAGE(R)@@     |
108 | Tokyo               | 12          | 20          | 16          | @@=AVERAGE(R)@@     |
109 | Maximum temperature | @@=MAX(C)@@ | @@=MAX(C)@@ | @@=MAX(C)@@ |                     |
110 | Minimum temperature | @@=MIN(C)@@ | @@=MIN(C)@@ | @@=MIN(C)@@ |                     |
111
112 == Limitations ==
113
114 The formulas are evaluated line per line, from left to right.
115
116 So this will work:
117
118 {{{
119 |          10 |         -13 | @@=SUM(R)@@ |
120 |          15 |          17 | @@=SUM(R)@@ |
121 | @@=SUM(C)@@ | @@=SUM(C)@@ | @@=SUM(R)@@ |
122 }}}
123
124 |          10 |         -13 | @@=SUM(R)@@ |
125 |          15 |          17 | @@=SUM(R)@@ |
126 | @@=SUM(C)@@ | @@=SUM(C)@@ | @@=SUM(R)@@ |
127
128 And this will not:
129
130 {{{
131 | @@=SUM(R)@@ |          10 |         -13 |
132 | @@=SUM(R)@@ |          15 |          17 |
133 | @@=SUM(R)@@ | @@=SUM(C)@@ | @@=SUM(C)@@ |
134 }}}
135
136 | @@=SUM(R)@@ |          10 |         -13 |
137 | @@=SUM(R)@@ |          15 |          17 |
138 | @@=SUM(R)@@ | @@=SUM(C)@@ | @@=SUM(C)@@ |
139
140 == Author ==
141
142 * Marc-Etienne Vargenau, Alcatel-Lucent
143
144 <noinclude>
145 ----
146 [[PhpWikiDocumentation]]
147 </noinclude>