From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eBmJHPWq0GAvPwEAgWs5BA (envelope-from ) for ; Mon, 21 Jun 2021 17:06:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id sGFOGPWq0GCxOAAA1q6Kng (envelope-from ) for ; Mon, 21 Jun 2021 15:06:29 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D2E7E858D for ; Mon, 21 Jun 2021 17:06:28 +0200 (CEST) Received: from localhost ([::1]:35528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lvLVL-0005cM-Jx for larch@yhetil.org; Mon, 21 Jun 2021 11:06:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvLUJ-0004a1-4D for emacs-orgmode@gnu.org; Mon, 21 Jun 2021 11:05:23 -0400 Received: from ciao.gmane.io ([116.202.254.214]:54828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvLUE-0007O2-K2 for emacs-orgmode@gnu.org; Mon, 21 Jun 2021 11:05:22 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lvLUB-0006yd-6k for emacs-orgmode@gnu.org; Mon, 21 Jun 2021 17:05:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-orgmode@gnu.org To: emacs-orgmode@gnu.org From: Uwe Brauer Subject: table: problem with nan and if Date: Mon, 21 Jun 2021 17:05:09 +0200 Message-ID: <874kdri7h6.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cancel-Lock: sha1:LBFADuE50mMMiWtv6DWuG5vkgO4= Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624287988; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=EzQLPWCcQjYPD54PMcI64iYZK7MKaQJWhPGbN/uMu70=; b=lQXG6ZWLU7tlnwmvxqtIssk+uQzMn/5EJcpsrESUbXkiyldfMzAC4WfQfDwo9quYDsiAbC BfTlxzkZiheRqTIXaig6/PYnOngbOGy5ccleeFhYhAHhz6dqqjLC9Xw4KTlKihZl3hxXHp 0jbcPIpHDetOq03fJa8lWLINH+ocBntIDYaXQ4NvOurSUNJrslb3Ep3X+gpjYlOM7oyGaL bfkZ9COzQdhuJqEc205ZNFq/39nBV5hMYi8g161ErqcwnC7uT1bqT0F8NtNJOCa7supCzB svugXXgy/l4vy5zQkU4mtYj9WOqSc1ort/dWZkrHsBEwIvaHqenSJbPXt8gaCg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624287988; a=rsa-sha256; cv=none; b=F0UFboFiRk/WOSS/7b0BvZA8sADaGbUWfZmrtBnG3Wf6eEsUHB3pPl+VaeWQWqoRN5yLya AEFrbrgnmeXgddOEeSWs/oIGV3zRfhLjWReSLs5Fa5D74iZ2RGkceVpqZNoYbz7tuK5eDT 861NfTv3ONI8RbZ2cvNkPVL7n8LzUjT8Nrt7DCbbcNulMBeSDbW4brorb384bAQHZAzLEu 9FMpcbQ3LYlCJbGyTOfv5nLagU0R38zoewjZgH681lop2pKJOsswrDF3mwcY6avejS2v4W zOsItiqhB5AfBnpXgwJlNY5VBDSe8Foe3eOMiTeYfelBqLSrPIFo6MrmNtX6iA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=mat.ucm.es (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: D2E7E858D X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: vAICuhgZP2Ps Hi I have the following table #+begin_src elisp #+NAME: test | Name | E1 | E2 | E3 | Result1 | Result2 | Final | |-------+----+----+-----+---------+---------+-------| | User1 | | | | | 8 | nan | | User2 | | | | | | | | User3 | 1 | 0 | 3.5 | 4.5 | 5.8 | 4.8 | |-------+----+----+-----+---------+---------+-------| #+TBLFM: $5=if(typeof(vsum($2..$4)) == 12, string(" "),vsum($2..$4));E f-1::$7=if("$6" == "nan", string(" "),0.3*$5+0.6*$6); E f-1 #+end_src The calculations for User2 and 3 are fine, but for User1, the final result is a "nan". I see the problem is caused by ; E f-1 I don't understand why because As in #+begin_src elisp | user1 | User2 | | |-------+-------+-----| | | 3 | nan | | 0 | 1 | 0.8 | #+TBLFM: $3=0.2*$1+0.8*$2; E f-1 #+end_src I am not sure, but should I use something like if("$5" == "nan", string(" "),0.6*$6); E;f-1 But how can I combine both ifs, I am puzzled Any help is strongly appreciated. Uwe Brauer