From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: tables: sum columns only in certain ranges of rows Date: Thu, 7 Jul 2016 09:02:35 +0200 Message-ID: References: <87oa6db4kx.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL3KZ-0007fv-RG for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 03:02:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bL3KX-0007nu-PM for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 03:02:38 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:34296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL3KX-0007no-IY for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 03:02:37 -0400 Received: by mail-wm0-x236.google.com with SMTP id 187so1043915wmz.1 for ; Thu, 07 Jul 2016 00:02:37 -0700 (PDT) In-Reply-To: <87oa6db4kx.fsf@mat.ucm.es> 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: Org Mode Hi Uwe On Mon, Jul 4, 2016 at 9:12 PM, Uwe Brauer wrote: > Is the a simple way to tell a org-table that > it adds say two columns in a certain way $4=0.2*($2+$3) > but only for certain values of the row. I hoped that > a hline would help but it does not the row containing Taylor > is treated in the same way as row 1 to 4. > > > | Row | Name | E1 | E2 | Res | > |-----+--------+----+----+-----| > | 1 | Smith | 1 | 2 | 0.6 | > | 2 | Miller | 2 | 1 | 0.6 | > | 3 | Meyer | 1 | 4 | 1. | > | 4 | Wilson | 2 | 1 | 0.6 | > |-----+--------+----+----+-----| > | 5 | Taylor | 1 | 2 | 0.6 | > |-----+--------+----+----+-----| > #+TBLFM: $1=@#-1::$5=0.2*($3+$4) > > > So what is the most comfortable to obtain what I want? Depending on what you want you can use $5 = if($1 != 5, 0.2*($3+$4), string("")). See also some other examples with if in the Org manual. Michael