emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] adding up decimal fractions in the spreadsheet


From: Carsten Dominik
Subject: Re: [Orgmode] adding up decimal fractions in the spreadsheet
Date: Sat, 27 Sep 2008 19:59:51 +0200

Hi Rainer,

On Sep 27, 2008, at 4:20 PM, Rainer Thiel wrote:

Hi Carsten,

2008/9/27 Carsten Dominik <address@hidden>:
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: @address@hidden@address@hidden@address@hidden@address@hidden@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(@address@hidden)

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(@address@hidden)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]