4

In org-mode, I can sum the rows in a column as follows:

|   | Column 1 |
|   |          |
|---+----------|
|   |        1 |
| 2 |        2 |
| 3 |        3 |
|   |        4 |
|---+----------|
|   |          |
|---+----------|
#+TBLFM: @7$2=vsum(@I..@II)

However, if I add some lines in the middle, the coordinates of @7$1 will move. According to the documentation, I've tried to modify the formula to

#+TBLFM: @II+1$2=vsum(@I..@II)

However, the result for the last line is:

|---+----------|
| 5 |       10 |
|---+----------|

Why is it also summing the first column ?

4
  • 1
    If I understand you correctly, you wanted this: #+TBLFM: @>$2=vsum(@<<$2..@>>$2), right? – wvxvw Oct 25 '15 at 8:36
  • 2
    If you add rows with M-S-down, the formulas are updated automatically. E..g. adding one row will update the formula in the first example to @8$2=... – Juancho Oct 25 '15 at 13:09
  • With respect to your question, the fact that @II+1$2 also updates the first column is unexpected, and deserves a bug submission. – Juancho Oct 25 '15 at 13:14
  • FWIW, you cannot use hline relative reference on the left hand side, at least from what I see on the latest org built from its master (dev) branch. I get this error: user-error: Can’t assign to hline relative reference. – Kaushal Modi May 23 '16 at 14:41
1
#+TBLFM: @II+1$2=vsum(@I..@II)

Doesn't do anything for me (org-version 8.3.1), but this works:

#+TBLFM: @>$2=vsum(@I..@II)

ie: last row of table.

2
  • But how to put the sum in the row after the second separator, and not necessarily in the last row of the table ? – Klaus Oct 26 '15 at 7:29
  • @Klaus I do not think that you can use the hline references (like I and II) on the left hand side in the equations. I get this error user-error: Can’t assign to hline relative reference when I try to do so on the latest org built from its master (dev) branch. – Kaushal Modi May 23 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.