From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: Re: problem with empty column Date: Sat, 06 Jan 2018 09:37:04 +0100 Message-ID: <87shbjv0wf.fsf@mat.ucm.es> References: <87h8s0yaj5.fsf@mat.ucm.es> <87zi5sk5ru.fsf@gmail.com> <87lghcwk3f.fsf@mat.ucm.es> <87y3lcgy71.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXjyn-0004lD-AP for emacs-orgmode@gnu.org; Sat, 06 Jan 2018 03:37:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXjyk-0006t3-67 for emacs-orgmode@gnu.org; Sat, 06 Jan 2018 03:37:25 -0500 Received: from [195.159.176.226] (port=41516 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXjyk-0006qk-0E for emacs-orgmode@gnu.org; Sat, 06 Jan 2018 03:37:22 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eXjwc-0003Mk-AK for emacs-orgmode@gnu.org; Sat, 06 Jan 2018 09:35:10 +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 13:44, Uwe Brauer wrote: >> What I meant is this. > I understood what you meant and your code is working properly. You > are checking the second column which is the column labelled E1, not > the one labelled E2 which is actually the third column... change your > if statement to check $3, not $2. Maybe the format of the table was distorted. | 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 The column of reference is E1 per default, which is the second one. The row labeled Entry1 gives the expected result, NP, since its E1 entry is empty but in the row labeled Entry3 E1 is not empty, so the second part of the statement should be applied resulting in 6, but it does not it results in nan, which I don't understand. The fact that E2 ($3) is empty should be irrelevant here, but it is not. On the other hand | Name | E1 | E2 | E3 | E4 | Res | |--------+----+----+----+----+-----| | Entry1 | | | | | NP | | Entry2 | 10 | 20 | 30 | 40 | 10 | | Entry3 | 10 | 0 | 20 | 30 | 6 | #+TBLFM: $6=if("$2" == "nan" , string("NP"),($2+$3+$4+$5)/10);E Gives the expected result, that is adding 0 to E2 in row Entry3. I am puzzled Uwe