From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Sub-totals Date: Wed, 19 Feb 2014 07:54:24 -0500 Message-ID: <87r46zclfj.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG6fk-0007eW-QT for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 07:54:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG6fe-0007eL-OB for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 07:54:44 -0500 Received: from plane.gmane.org ([80.91.229.3]:59990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG6fe-0007e6-Gu for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 07:54:38 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WG6fb-0007SK-G4 for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 13:54:35 +0100 Received: from pool-98-110-172-167.bstnma.fios.verizon.net ([98.110.172.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Feb 2014 13:54:35 +0100 Received: from ndokos by pool-98-110-172-167.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Feb 2014 13:54:35 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cecil Westerhof writes: > 2014-02-16 10:06 GMT+01:00 Michael Brand : > > > - 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