From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Re: table spreadsheet problem Date: Mon, 19 Mar 2012 10:48:15 -0500 Message-ID: <20120319154815.GT31713@x201> References: <20120319153221.GN31713@x201> <3B9D3356-14B5-4CAB-AD29-D0F97E425F04@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9epT-0004BK-UG for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:49:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9epH-0000ky-KF for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:49:03 -0400 Received: from jack.asmallorange.com ([74.52.119.82]:35339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9epH-0000kS-EW for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:48:51 -0400 Received: from 206.180.155.43.adsl.hal-pc.org ([206.180.155.43] helo=localhost) by jack.asmallorange.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1S9epE-003zvX-0h for emacs-orgmode@gnu.org; Mon, 19 Mar 2012 11:48:48 -0400 Content-Disposition: inline In-Reply-To: <3B9D3356-14B5-4CAB-AD29-D0F97E425F04@gmail.com> 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 On Mon, Mar 19, 2012 at 04:45:14PM +0100, Martin Halder wrote: > > Am 19.03.2012 um 16:32 schrieb Russell Adams: > > | article | price | > > |---------+--------| > > | item1 | 100.00 | > > | item2 | 200.00 | > > |---------+--------| > > | sum | 300.00 | > > | tax | 24.00 | > > |---------+--------| > > | sum | 324.00 | > > #+TBLFM: @4$2=vsum(@-I..@-II);%.2f::@5$2=@4$2*0.08;%.2f::@6$2=vsum(@-I..@-II);%.2f > > > > I often use negative headline references for total lines in order to > > sum backward from the current cell. > > > > 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). > > > > 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. > > > > I used C-u C-c = to set mine. > > > > Good luck! > > > 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 ? > If you use the table editor properly, it will keep the formulas up to date for you. For instance, if you place your cursor on item2 and press return, a new line should be created and the formulas cell references corrected to match. Beware commands line C-k that may delete a row as text instead of using the Org-Mode specific table editing commands. If you want to delete a line like C-k, use M-S-Up instead. ------------------------------------------------------------------ Russell Adams RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3