From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Sub-totals Date: Sun, 16 Feb 2014 10:06:14 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WExg0-0002ZI-4w for emacs-orgmode@gnu.org; Sun, 16 Feb 2014 04:06:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WExfy-0005Y2-VJ for emacs-orgmode@gnu.org; Sun, 16 Feb 2014 04:06:16 -0500 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:34511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WExfy-0005Xv-Qf for emacs-orgmode@gnu.org; Sun, 16 Feb 2014 04:06:14 -0500 Received: by mail-qa0-f48.google.com with SMTP id f11so20262298qae.7 for ; Sun, 16 Feb 2014 01:06:14 -0800 (PST) In-Reply-To: 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: Cecil Westerhof Cc: Org Mode Hi Cecil On Sat, Feb 15, 2014 at 6:14 PM, Cecil Westerhof wrote: > - 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("") Michael