Cecil Westerhof <cldwester...@gmail.com> writes: > 2014-02-16 10:06 GMT+01:00 Michael Brand <michael.ch.br...@gmail.com>: > > > - I would like to have only the last element of the range filled. > > I always thought that this would not be possible with reasonable > effort. Your question made me think again and it is possible, now I > can change my own use cases with sub-total :-) . See docstring and > take the procedure with vlen etc. from the TBLFM of the new ERT > test-org-table/sub-total here: > > http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob;f=testing/lisp/test-org-table.el > > Or read the docstring there and just take this copy that I used to > build the ERT: > |-------+-------+-------| > | Item | Item | Sub- | > | name | value | total | > |-------+-------+-------| > | a1 | 4.1 | | > | a2 | 8.2 | | > | a3 | | 12.3 | > |-------+-------+-------| > | b1 | 16.0 | 16.0 | > |-------+-------+-------| > | c1 | 32 | | > | c2 | 64 | 96.0 | > |-------+-------+-------| > | Total | 124.3 | | > |-------+-------+-------| > #+TBLFM: @>$2 = vsum(@II..@>>) :: $3 = if(vlen(@-I$2..@0$2) == > vlen(@-I$2..@+I$2), vsum(@-I$2..@+I$2) +.0, string("")); EN f-1 :: > @>$3 = string("") > > I made: > #+TBLFM: @>$2 = vsum(@<<..@>>) :: @<<$3..@>>$3 = if(vlen(@-I$2..@0$2) == > vlen(@-I$2..@+I$2), vsum(@-I$2..@+I$2), string("")) >
Nice! Worth a mention in the org-hacks section on Worg I think. -- Nick