Trying to do a sum of every table value in one line

So, I have a table that has a bunch of total values on separated lines, and I’m trying to sum these values in one line below.

Column 1 Column 2 Column 3 Column 4
value 1 10 10 10
value 2 20 20 20
value 3 30 30 30
value 4 40 40 40
total 100 100 100
Total Value 300
This is an example of how the table is.

I use this formula TBLFM: @>$2=sum(@I…@-1) to sum every value on the 2nd line, and two more to sum the values on the rest of the rows.

Here is a complete working example summing both ways using Advanced Tables plugin:


| Denom  | Mine | Yours | Sum |
| ------ | ---- | ----- | --- |
| 1      | 1    | 2     | 3   |
| 5      | 13   | 4     | 17  |
| 10     | 5    | 6     | 11  |
| 20     | 7    | 8     | 15  |
| ---    | ---  | ---   |     |
| Totals | 26   | 20    |     |
<!-- TBLFM: @2$>=sum($2..$-1)::@3$>=sum($2..$-1) -->
<!-- TBLFM: @4$>=sum($2..$-1) -->
<!-- TBLFM: @5$>=sum($2..$-1) -->
<!-- TBLFM: @>$2..@>$3=sum(@I..@-2) -->

The first lines is using a range on the lines, instead of the simpler line specifications on the second and third line. The last line uses a column range to do the sums of column two and three.

Remember that after changing the table data, you need to place your cursor within the column and hit the recalculate icon from the side panel, or trigger the command Advanced Tables: Evaluate table formulas. It doesn’t happen automatic.

1 Like