emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] empty cells in columns should be left emtpy when manipulating co


From: Michael Brand
Subject: Re: [O] empty cells in columns should be left emtpy when manipulating columns
Date: Fri, 23 Jun 2017 18:20:19 +0200

Hi Uwe

On Thu, Jun 22, 2017 at 9:56 AM, Uwe Brauer <address@hidden> wrote:

> #+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15;%.1f);E
>
> And friends did not work any more
>
> | 3.25 | 0.5) |
> |      | 0.0) |
> #+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15;%.1f);E

This is invalid syntax, what you meant would be:

| 3.25 | 0.5 |
|      | 0.0 |
#+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15);E %.1f

To preserve empty columns when reformatting you can use the Calc
formatter:

| 3.25 | 0.5 |
|      |     |
#+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15);E f-1

    (info "(org) Formula syntax for Calc")

    `if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1'
      Sum of the first two columns.  When at least one of the input
      fields is empty the Org table result field is set to empty.  `E'
      is required to not convert empty fields to 0.  `f-1' is an
      optional Calc format string similar to `%.1f' but leaves empty
      results empty.

See also
"Which float format shows the fraction part also when the latter is
zero?"
http://orgmode.org/worg/org-faq.html#table-float-fraction

Michael



reply via email to

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