md-advanced-tables icon indicating copy to clipboard operation
md-advanced-tables copied to clipboard

horizontal sums

Open JohannaTe opened this issue 1 year ago • 4 comments

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
Screenshot 2023-10-03 at 7 55 06 AM

JohannaTe avatar Oct 02 '23 21:10 JohannaTe

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))) -->

khorton avatar Oct 03 '23 02:10 khorton

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))) -->

khorton avatar Oct 03 '23 02:10 khorton

Fantastic! Thanks so much, works like a charm.

JohannaTe avatar Oct 03 '23 02:10 JohannaTe

Or even more concisely,

<!-- TBLFM: $5=sum($1..$4) -->

sbliven avatar May 29 '24 09:05 sbliven