all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: empty cells in columns should be left emtpy when manipulating columns
Date: Fri, 23 Jun 2017 18:20:19 +0200	[thread overview]
Message-ID: <CALn3zoigDVBz-Viu59dxtY40L8v-Vi7vL49y=Wv6natkCmoXwA@mail.gmail.com> (raw)
In-Reply-To: <87fueslal4.fsf@mat.ucm.es>

Hi Uwe

On Thu, Jun 22, 2017 at 9:56 AM, Uwe Brauer <oub@mat.ucm.es> 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	other threads:[~2017-06-23 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  7:25 empty cells in columns should be left emtpy when manipulating columns Uwe Brauer
2017-06-22  7:34 ` Nicolas Goaziou
2017-06-22  7:56   ` Uwe Brauer
2017-06-23 16:20     ` Michael Brand [this message]

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

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

  git send-email \
    --in-reply-to='CALn3zoigDVBz-Viu59dxtY40L8v-Vi7vL49y=Wv6natkCmoXwA@mail.gmail.com' \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.