1

I have this org-mode table in a file named 1.org:

| . |  A |   B |    C |
|---+----+-----+------|
| X | 10 | 100 | 1000 |
| Y | 20 | 200 | 2000 |
| Z | 30 | 300 | 3000 |
|---+----+-----+------|
| T |    |     |      |
#+TBLFM: @5$2..$4=vsum(@I..@II)

If I move the cursor to the #+TBLFM line and run C-c C-c, I get the totals of each column in the last row labelled T like so

| . |  A |   B |    C |
|---+----+-----+------|
| X | 10 | 100 | 1000 |
| Y | 20 | 200 | 2000 |
| Z | 30 | 300 | 3000 |
|---+----+-----+------|
| T | 60 | 600 | 6000 |
#+TBLFM: @5$2..$4=vsum(@I..@II)

All good so far. But if instead I place the cursor on the row labelled Y (for example, just place the cursor on Y) and then run C-u C-c C-c I get this

| . |   A |    B |     C |
|---+-----+------+-------|
| X |  10 |  100 |  1000 |
| Y |  60 |  600 |  6000 |
| Z | 100 | 1000 | 10000 |
|---+-----+------+-------|
| T | 170 | 1700 | 17000 |
#+TBLFM: @5$2..$4=vsum(@I..@II)

Why did it place the sum of each column in the row labelled Y even though the the #+TBLFM clearly says to put the sum in last row (row @5)?


Documentation of C-u C-c C-c - https://orgmode.org/manual/Updating-the-table.html

C-u C-c * or C-u C-c C-c

Recompute the entire table, line by line. Any lines before the first hline are left alone, assuming that these are part of the table header.

3
  • Good question and very much a bug I'm afraid (and a serious one at that). Please report it ASAP with M-x org-submit-bug-report.
    – NickD
    Jul 3 at 1:30
  • AFAICT, this (mis)behavior goes back a long way: at least back to 8.3.
    – NickD
    Jul 3 at 16:29
  • I have looked at this issue by enabling the debugger. org-table-toggle-formula-debugger is on C-c {, <menu-bar> <table> <Debug Formulas>. The problem is cursor IS NOT STARTING on a table cell that has a formula. It starts on a table cell that has a value. The issue is one of seeking the right cell, before doing eval. It seems to start on a cell on where the cursor is. Or it could be that inserts the calculated value in the wrong cell. (The problem actually seems a combination of both). May be this is problem could be isolated to a commit using a git bisect. Jul 21 at 5:04

0

Your Answer

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

Browse other questions tagged or ask your own question.