[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Sub-totals
From: |
Nick Dokos |
Subject: |
Re: [O] Sub-totals |
Date: |
Wed, 19 Feb 2014 07:54:24 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Cecil Westerhof <address@hidden> writes:
> 2014-02-16 10:06 GMT+01:00 Michael Brand <address@hidden>:
>
> > - 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(@address@hidden) ==
> vlen(@address@hidden), vsum(@address@hidden) +.0, string("")); EN f-1 ::
> @>$3 = string("")
>
> I made:
> #+TBLFM: @>$2 = vsum(@<<..@>>) :: @<<$3..@>>$3 = if(vlen(@address@hidden)
> == vlen(@address@hidden), vsum(@address@hidden), string(""))
>
Nice! Worth a mention in the org-hacks section on Worg I think.
--
Nick