From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Difference between two rows Date: Sun, 1 Jun 2014 13:57:09 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr4Ny-0002vB-Lb for emacs-orgmode@gnu.org; Sun, 01 Jun 2014 07:57:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wr4Nx-0004QZ-UX for emacs-orgmode@gnu.org; Sun, 01 Jun 2014 07:57:10 -0400 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:34401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wr4Nx-0004QV-Qg for emacs-orgmode@gnu.org; Sun, 01 Jun 2014 07:57:09 -0400 Received: by mail-qg0-f42.google.com with SMTP id q107so9137045qgd.15 for ; Sun, 01 Jun 2014 04:57:09 -0700 (PDT) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Cecil Westerhof Cc: Org Mode Hi Cecil On Sun, Jun 1, 2014 at 1:38 PM, Cecil Westerhof wrote: > I like to calculate in a table the difference between the value in a field > in the current row and the previous field. How would I do that? > > Something like: > |-------+------------| > | value | difference | > |-------+------------| > | 12 | | > | 15 | 3 | > | 83 | 68 | > | 87 | 4 | > | 85 | -2 | > |-------+------------| For such cases I prefer vlen(): #+TBLFM: $2 = if(vlen(@II..@0) == 1, string(""), $1 - @-1$1); E Michael