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