From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: Re: problem with empty column Date: Fri, 05 Jan 2018 13:44:52 +0100 Message-ID: <87lghcwk3f.fsf@mat.ucm.es> References: <87h8s0yaj5.fsf@mat.ucm.es> <87zi5sk5ru.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXRN8-0002IH-UT for emacs-orgmode@gnu.org; Fri, 05 Jan 2018 07:45:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXRN5-0004w3-Gm for emacs-orgmode@gnu.org; Fri, 05 Jan 2018 07:45:18 -0500 Received: from [195.159.176.226] (port=50922 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXRN4-0004uB-M3 for emacs-orgmode@gnu.org; Fri, 05 Jan 2018 07:45:15 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eXRKw-00068v-Vm for emacs-orgmode@gnu.org; Fri, 05 Jan 2018 13:43:02 +0100 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" To: emacs-orgmode@gnu.org >>> "Eric" == Eric S Fraga writes: > On Friday, 5 Jan 2018 at 09:28, Uwe Brauer wrote: [...] >> The last row behaves strangely the cell in the second >> column is *not* empty but the cell in the third one is, >> nevertheless the cell in the last column contains the >> string nan, which I don't understand. > But the second column is *not* empty; maybe you meant 3rd > column? What I meant is this. Take the following simple table | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | || Entry2 | 10 | 20 | 30 | 40 | | #+TBLFM: $6=($2+$3+$4+$5)/10 C-u C-u C-c C-c leads to | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | |13 | Entry2 | 10 | 20 | 30 | 40 | 10 | #+TBLFM: |$6=($2+$3+$4+$5)/10 Now for any new entry I want to have in the 6th column NP if the entry in the second column (not the whole column) is empty. | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | |13 | Entry2 | 10 | 20 | 30 | 40 | 10 | Entry3 | | | | || | Should lead to | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| Entry1 | 10 | 30 | 40 | 50 | |13 | Entry2 | 10 | 20 | 30 | 40 | 10 | Entry3 | | | | || NP | How can I achieve that? The following works well | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| Entry1 | | | | | |NP | Entry2 | 10 | 20 | 30 | 40 | 10 | #+TBLFM: $6=if("$2" == |"nan" , string("NP"),($2+$3+$4+$5)/10);E although the second column is *not* empty, but it is empty for Entry 1. But fails if there is a row like this | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| Entry1 | | | | | |NP | Entry2 | 10 | 20 | 30 | 40 | 10 | Entry3 | 10 | | 20 | |30 | nan | #+TBLFM: $6=if("$2" == "nan" , |string("NP"),($2+$3+$4+$5)/10);E Uwe