From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Format a whole column using ";%.2f" in orgtbl? Date: Thu, 21 Jun 2012 18:29:00 +0200 Message-ID: References: <30475045.6Ox6BBrYdW@linux-nyil.site> <3465224.sPDMcBHj5z@linux-nyil.site> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShkFu-0003g2-Ec for emacs-orgmode@gnu.org; Thu, 21 Jun 2012 12:29:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShkFj-0003K2-Si for emacs-orgmode@gnu.org; Thu, 21 Jun 2012 12:29:13 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:50652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShkFj-0003JZ-Jv for emacs-orgmode@gnu.org; Thu, 21 Jun 2012 12:29:03 -0400 Received: by wgbds1 with SMTP id ds1so552593wgb.30 for ; Thu, 21 Jun 2012 09:29:01 -0700 (PDT) In-Reply-To: <3465224.sPDMcBHj5z@linux-nyil.site> 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: AW Cc: emacs-orgmode@gnu.org Hi Alexander On Thu, Jun 21, 2012 at 12:15 PM, AW wrote: > | Values | Desc. | > |--------+-------| > | 100.00 | Value | > | 150.00 | Value | > | 250. | sum | > |--------+-------| > | 500. | End | > #+TBLFM: @4$1=@2$1+@3$1::@5$1=vsum(@I..@II)::$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: @4$1=@2$1+@3$1 +.0; f-2::@5$1=vsum(@I..@II) +.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: @4$1=@2$1+@3$1;%.2f::@5$1=vsum(@I..@II);%.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