md-advanced-tables
md-advanced-tables copied to clipboard
horizontal sums
Hi,
I'm having troubles getting a sum going that is more than two cells horizontally. The system tells me it cannot parse it. Would you be able to let me know how to fix this?
Thanks so much! Jo
This does not work:
I | II | III | iv | sum |
---|---|---|---|---|
2 | 3 | 5 | 6 |
Each individual math operation must be enclosed in parentheses.
Try:
| I | II | III | iv | sum |
| --- | --- | --- | --- | --- |
| 2 | 3 | 5 | 6 | 16 |
<!-- TBLFM: @2$5=(@2$1+(@2$2+(@2$3+@2$4))) -->
Also, you can leave out the column specifier "@2". This is less typing, and it will allow one formula to work for several rows.
| I | II | III | iv | sum |
| --- | --- | --- | --- | --- |
| 2 | 3 | 5 | 6 | 16 |
| 3 | 4 | 6 | 7 | 20 |
<!-- TBLFM: $5=($1+($2+($3+$4))) -->
Fantastic! Thanks so much, works like a charm.
Or even more concisely,
<!-- TBLFM: $5=sum($1..$4) -->