emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@uva.nl>
To: r.thiel@uni-jena.de
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: adding up decimal fractions in the spreadsheet
Date: Sat, 27 Sep 2008 19:59:51 +0200	[thread overview]
Message-ID: <44B9DF51-FE0E-4470-B698-3CEF45F31CCB@uva.nl> (raw)
In-Reply-To: <d6b6c7740809270720j3b44fd38q6171252e9ba86a7f@mail.gmail.com>

Hi Rainer,

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

> Hi Carsten,
>
> 2008/9/27 Carsten Dominik <dominik@uva.nl>:
>> 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

  reply	other threads:[~2008-09-27 18:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-27  7:19 adding up decimal fractions in the spreadsheet Rainer Thiel
2008-09-27 12:19 ` Carsten Dominik
     [not found]   ` <d6b6c7740809270606p679feb82n6fbe5f4d582ebcfa@mail.gmail.com>
     [not found]     ` <B1260157-B3E5-4704-8739-F4718BDFCAEC@uva.nl>
2008-09-27 14:20       ` Rainer Thiel
2008-09-27 17:59         ` Carsten Dominik [this message]
2008-09-27 13:21 ` Manish
2008-09-27 13:29   ` Rainer Thiel
2008-09-29  2:46     ` Manish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44B9DF51-FE0E-4470-B698-3CEF45F31CCB@uva.nl \
    --to=dominik@uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=r.thiel@uni-jena.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).