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 ms11 with LMTPS id eNNLNlmTU19YYwAA0tVLHw (envelope-from ) for ; Sat, 05 Sep 2020 13:32:09 +0000 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 YJgvMlmTU19PdwAA1q6Kng (envelope-from ) for ; Sat, 05 Sep 2020 13:32:09 +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 554019403A9 for ; Sat, 5 Sep 2020 13:32:09 +0000 (UTC) Received: from localhost ([::1]:52566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEYIZ-0000Tm-09 for larch@yhetil.org; Sat, 05 Sep 2020 09:32:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEYI6-0000T2-5M for emacs-orgmode@gnu.org; Sat, 05 Sep 2020 09:31:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34353) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEYI3-0006c5-Ke; Sat, 05 Sep 2020 09:31:36 -0400 Received: from lns-bzn-32-82-254-31-120.adsl.proxad.net ([82.254.31.120]:51872 helo=guerry) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1kEYI2-00036V-FJ; Sat, 05 Sep 2020 09:31:35 -0400 Received: by guerry (Postfix, from userid 1000) id 427131A60644; Sat, 5 Sep 2020 15:31:16 +0200 (CEST) From: Bastien To: Kristof Ralovich Subject: Re: table formula, empty field, duration Organization: GNU References: <5bce53e44fd04641e977a3ea52ed7d521670a678.camel@ralovich.hu> Date: Sat, 05 Sep 2020 15:31:16 +0200 In-Reply-To: <5bce53e44fd04641e977a3ea52ed7d521670a678.camel@ralovich.hu> (Kristof Ralovich's message of "Thu, 06 Aug 2020 08:24:23 +0200") Message-ID: <87tuwcic4b.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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-Spam-Score: -1.01 X-TUID: 2ETTJQOUuHpl Hi Kristof, Kristof Ralovich writes: > it appears to me that the concept of "empty field" is not defined for > time durations, or it is quite different to how it is defined for > numbers (using org-mode 9.1.9). > > In the first table, the empty row @6 produces an empty field for the sum > ($5, first formula), that vmean is able to "skip" (second formula) and > gives the expected result 8.25 (=33/4). > > #+TBLNAME: works_with_numbers > | h | start | end | h | sum | h | h | > > |---+-------+-----+---+-----+------+---| > | | 08 | 18 | | 10 | | | > | | 11 | 15 | | 4 | | | > | | 09 | 20 | | 11 | | | > | | 10 | 18 | | 8 | | | > | | | | | | | | > |---+-------+-----+---+-----+------+---| > | | | | | 33 | 8.25 | | > > #+TBLFM: $5=if(typeof($3-$2)==12, string(""), $3-$2);E::@>$5=vsum(@2..@-1); > #+TBLFM: @>$6=vmean(@2$5..@-1$5); Can you provide a more minimal example? The following table works correctly here (maint and master): | mean1 | mean2 | |-------+-------| | 08:00 | 08:00 | | 09:00 | 09:00 | | 00:00 | | |-------+-------| | 05:40 | 08:30 | #+TBLFM: @5$1=vmean(@2..@-1);U #+TBLFM: @5$2=vmean(@2..@-1);U So I suspect this is something wrong with your first formula: > #+TBLFM: $5=if(typeof($3-$2)==12, string(""), $3-$2);E Let me know if you manage to nail down something more precise. Thanks, -- Bastien