From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: adding up decimal fractions in the spreadsheet Date: Sat, 27 Sep 2008 19:59:51 +0200 Message-ID: <44B9DF51-FE0E-4470-B698-3CEF45F31CCB@uva.nl> References: <2550EE81-2105-41DC-B0A3-40D3D62B788C@uva.nl> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kje5L-0008PB-AS for emacs-orgmode@gnu.org; Sat, 27 Sep 2008 14:00:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kje5J-0008Oq-Vn for emacs-orgmode@gnu.org; Sat, 27 Sep 2008 14:00:03 -0400 Received: from [199.232.76.173] (port=43019 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kje5J-0008On-OI for emacs-orgmode@gnu.org; Sat, 27 Sep 2008 14:00:01 -0400 Received: from pony.ic.uva.nl ([145.18.40.181]:40695) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kje5J-00028D-6u for emacs-orgmode@gnu.org; Sat, 27 Sep 2008 14:00:01 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: r.thiel@uni-jena.de Cc: emacs-orgmode Hi Rainer, On Sep 27, 2008, at 4:20 PM, Rainer Thiel wrote: > Hi Carsten, > > 2008/9/27 Carsten Dominik : >> The other thing you can do is to use your own format to convert the >> number. >> Maybe something like "%.2f" will work for you? Hard to make this >> correct >> for the general case though. > > Yes, this is not a way to go, as far as I can see, for exactly that > reason. I agree. > > > Interestingly, > > | 12130.68 | > | -1444.19 | > | -12744.90 | > | -186.00 | > | 7000.00 | > | -7056.00 | > | -335.58 | > | -277.00 | > | -2912.99 | > #+TBLFM: @9$1=@1$1+@2$1+@3$1+@4$1+@5$1+@6$1+@7$1+@8$1 > > gives the correct value, there's no need to add `;f2' at the end of > the last line. Yes, calc has its own rules for formatting numbers > This in itself is a way to go, of course, but would be > more comfortable to have a way to sum up all rows but the last one > (without having to keep track of the number of rows) or at least to > work with ranges, which as far as I have seen so far seems not to be > possible in this case. Check out the manual section about the spreadsheet, and the corresponding tutorial on worg. A lot can be done with that, and there are ranges between row numbers or between horizontal lines. In your example: | 12130.68 | | -1444.19 | | -12744.90 | | -186.00 | | 7000.00 | | -7056.00 | | -335.58 | | -277.00 | | -2912.99 | #+TBLFM: @9$1=vsum(@1..@8) Or much better: |-----------| | 12130.68 | | -1444.19 | | -12744.90 | | -186.00 | | 7000.00 | | -7056.00 | | -335.58 | | -277.00 | |-----------| | -2912.99 | #+TBLFM: @9$1=vsum(@I..@II) Add new line with M-S-down, so that the absolute reference to the last row will automatically be shifted. org-table-sum is an old hack, from before the existence of the spreadsheet functions. I still use I, but only occasionally, not for anything I need to change and recompute. > > > These are minutiae, of course. org-mode is already excellent, and > since I discovered it a few weeks ago, I've been making use of it at > all times. Good to know. - Carsten