From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Halder Subject: Re: table spreadsheet problem Date: Mon, 19 Mar 2012 16:45:14 +0100 Message-ID: <3B9D3356-14B5-4CAB-AD29-D0F97E425F04@gmail.com> References: <20120319153221.GN31713@x201> Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9emI-0002Wx-8A for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:45:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9elr-0008Ps-1r for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:45:45 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:53911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9elq-0008PC-Hh for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:45:18 -0400 Received: by wibhj13 with SMTP id hj13so2968345wib.12 for ; Mon, 19 Mar 2012 08:45:16 -0700 (PDT) In-Reply-To: <20120319153221.GN31713@x201> 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: Russell Adams Cc: emacs-orgmode@gnu.org Am 19.03.2012 um 16:32 schrieb Russell Adams: > On Mon, Mar 19, 2012 at 04:01:42PM +0100, Martin Halder wrote: >> Hi all, >>=20 >> question about table calculation. Found in the documentation that I = could refer to e.g. first line after second hline with @II+2. >>=20 >> Would like to calculate sum =3D vsum(@I..@II) and tax =3D sum * 0.08 >>=20 >> Am I doing sth wrong ? >>=20 >> Thanks for help, >> Martin >>=20 >> | article | price | >> |---------+--------| >> | item1 | 100.00 | >> | item2 | 200.00 | >> |---------+--------| >> | sum | | >> | tax | | >> |---------+--------| >> | sum | 0 | >> #+TBLFM: = @II+1$2=3Dvsum(@I..@II);f2N::@II+2$2=3D@II+1$2*0.08;f2N::@>$2=3Dvsum(@II..= @III);f2N >>=20 >>=20 >=20 > | article | price | > |---------+--------| > | item1 | 100.00 | > | item2 | 200.00 | > |---------+--------| > | sum | 300.00 | > | tax | 24.00 | > |---------+--------| > | sum | 324.00 | > #+TBLFM: = @4$2=3Dvsum(@-I..@-II);%.2f::@5$2=3D@4$2*0.08;%.2f::@6$2=3Dvsum(@-I..@-II)= ;%.2f >=20 > I often use negative headline references for total lines in order to > sum backward from the current cell. >=20 > So vsum(@-I..@-II);%.2f means sum the cells between the first headline > above the current cell to the second headline above the current cell, > and then format the result as a decimal with two decimal places > (%.2f). >=20 > Looking at your formula, I think you manually wrote the TBLFM > line. One thing I've found is that the TBLFM line doesn't support > relative references for the cell specification, only in the formula. >=20 > I used C-u C-c =3D to set mine. >=20 > Good luck! >=20 Hi Russell, right, I wrote it manually. Thanks for your formula, the problem I have = is that there could be an "item 3" and therefore the "sum", "tax" and second "sum" = lines are not fixed. Is there a solution to specify them dynamically or do I have to modify = the position every time I enter a new item ? Thanks, Martin > ------------------------------------------------------------------ > Russell Adams RLAdams@AdamsInfoServ.com >=20 > PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ >=20 > Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3 >=20