From mboxrd@z Thu Jan 1 00:00:00 1970 From: AW Subject: Re: Format a whole column using ";%.2f" in orgtbl? Date: Thu, 21 Jun 2012 22:18:58 +0200 Message-ID: <4670487.IuZV0oIHQL@linux-nyil.site> References: <30475045.6Ox6BBrYdW@linux-nyil.site> <3465224.sPDMcBHj5z@linux-nyil.site> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShnqS-0006gx-Tj for emacs-orgmode@gnu.org; Thu, 21 Jun 2012 16:19:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShnqQ-0000H4-L9 for emacs-orgmode@gnu.org; Thu, 21 Jun 2012 16:19:12 -0400 Received: from mailout08.t-online.de ([194.25.134.20]:45937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShnqQ-0000GP-BT for emacs-orgmode@gnu.org; Thu, 21 Jun 2012 16:19:10 -0400 In-Reply-To: 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: Michael Brand Cc: emacs-orgmode@gnu.org 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 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