On Sat, 15 Feb 2025 at 14:58, Ihor Radchenko <yanta...@posteo.net> wrote:
> Paul Stansell <paulstans...@gmail.com> writes: > > > Using "C-c + C-y" in the last cell of the table below to sum the column > > gives the wrong answer because the "2025" part of the date in the header > is > > being included in the sum. > > > > |---------| > > | 2025-01 | > > |---------| > > | 10 | > > | 20 | > > |---------| > > | 2055 | > > |---------| > > > > Previous versions of org mode did not behave this way. > > I tested Org mode shipped with Emacs 26 and it did behave the same way. > Thanks for looking at it. I didn't actually test with previous versions of org mode, but since I use it a lot I thought I would have noticed it before, which I hadn't, so I thought it was new. Note that your example is rather ambiguous. Summing 2025-01, 10, and 20 > is not meaningful. > The header row that contains 2025-01 is supposed to represent a date in the YYYY-MM format, not a number, so I expected org to sum just the numbers to get 30, and not to include the first part of the date in the sum. I checked if org was evaluating 2025-01 = 2024 before summing down the column, but it wasn't. Here are some more examples of unexpected behaviour (with the first column giving the expected behaviour) |----+----+-----+-----+-----| | A1 | 1A | .1A | +1A | -1A | |----+----+-----+-----+-----| | 1 | 1 | 1 | 1 | 1 | | 1 | 1 | 1 | 1 | 1 | |----+----+-----+-----+-----| | 2 | 3 | 2.1 | 3 | 1 | |----+----+-----+-----+-----| It seems that, if the string used as the column name in the header begins with a number, the numeric part of the string is included in the sum.