emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Format a whole column using ";%.2f" in orgtbl?


From: AW
Subject: Re: [O] Format a whole column using ";%.2f" in orgtbl?
Date: Thu, 21 Jun 2012 22:18:58 +0200
User-agent: KMail/4.8.4 (Linux/3.4.2-28-desktop; KDE/4.8.4; x86_64; ; )

Hi Michael

Thank you very much for your quick, qualified and       satisfying answer!

Alexander

> Hi Alexander
> 
> On Thu, Jun 21, 2012 at 12:15 PM, AW <address@hidden> wrote:
> > | Values | Desc. |
> > |
> > |--------+-------|
> > |
> > | 100.00 | Value |
> > | 150.00 | Value |
> > | 
> > |   250. | sum   |
> > |
> > |--------+-------|
> > |
> > |   500. | End   |
> > 
> > #+TBLFM: @address@hidden@3$1::@5$1=vsum(@address@hidden)::$1=$0 +.0; f-2
> > 
> > I get at least every number in column 1 with a dot, but without ".00", as
> 
> > needed:
> The ending dot is Calc syntax and means a float with fraction 0.
> 
> > *Do I have to ad '; f-2' to every formula?*
> 
> Yes, else the Calc result is inserted without change. There is a
> formula debugger that shows the formatting steps nicely: "C-c {"
> 
> The "+.0" is necessary too to convert Calc integer to Calc float for
> some cases as shown in the example tables here:
> http://orgmode.org/worg/org-faq.html#table-float-fraction
> 
> All together:
> #+TBLFM: @address@hidden@3$1 +.0; f-2::@5$1=vsum(@address@hidden) +.0; 
> f-2::$1=$0 +.0;
> f-2
> 
> This is what I recommend just in general and what I do always myself
> as a habit because it can deal also with higher precision or the case
> when those of the fields resulting in an empty string should remain
> empty instead of a "0.00". If you don't want to be prepared for all
> that, for your current example you can still use just
> 
> #+TBLFM: @address@hidden@3$1;%.2f::@5$1=vsum(@address@hidden);%.2f::$1=$0;%.2f
> 
> > And besides that, I've never seen this description "f-2". Is it explained
> > somewhere for non-mathematicians?
> 
> For an explanation see the URLs to the Calc manual mentioned here
> http://orgmode.org/worg/org-faq.html#table-float-fraction
> after "For f3 and f-3 see `d f' (`calc-fix-notation')".
> 
> Michael



reply via email to

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