From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Can this table formula be done more efficient Date: Sun, 08 Jun 2014 09:07:16 -0400 Message-ID: <8738ffsg6z.fsf@gmail.com> References: <87tx7vk482.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtcpB-0006qJ-Kc for emacs-orgmode@gnu.org; Sun, 08 Jun 2014 09:07:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wtcp6-0007sx-79 for emacs-orgmode@gnu.org; Sun, 08 Jun 2014 09:07:49 -0400 Received: from mail-qg0-x235.google.com ([2607:f8b0:400d:c04::235]:55174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtcp6-0007sl-30 for emacs-orgmode@gnu.org; Sun, 08 Jun 2014 09:07:44 -0400 Received: by mail-qg0-f53.google.com with SMTP id f51so7800082qge.12 for ; Sun, 08 Jun 2014 06:07:43 -0700 (PDT) In-Reply-To: <87tx7vk482.fsf@gmail.com> (Nick Dokos's message of "Sun, 08 Jun 2014 07:53:01 -0400") 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: Nick Dokos Cc: emacs-orgmode@gnu.org Nick Dokos writes: > Cecil Westerhof writes: > >> At the moment I am using the following formula: >> =C2=A0=C2=A0=C2=A0 #+TBLFM: @<<$4..@>>$4 =3D $2 - $3 :: @>$2=3Dvsum(@<<$= 2..@>>$2) :: >> @>$3=3Dvsum(@<<$3..@>>$3) :: @>$4=3Dvsum(@<<$4..@>>$4) >> >> This does what I want, but there are two things that could be improved. >> >> - The second, third and fourth formula do exactly the same, only on >> different columns. Could this be rewritten to one formula? >> > > --8<---------------cut here---------------start------------->8--- > #+TBLFM: @<<$4..@>>$4 =3D $2 - $3 :: @>$2..$4=3Dvsum(@<<$0..@>>$0) > --8<---------------cut here---------------end--------------->8--- > > See (info "(org) References") > >> - The line becomes long and hard to evaluate for a person. Is there >> a possibility to put the formulas below each-other? >> > > I don't believe so but my belief may be out of date. It has been > discussed before: check the list archives. Sort of but not really. See "Using multiple #+TBLFM lines" in the manual. ,---- | Using multiple #+TBLFM lines | ............................ |=20 | You may apply the formula temporarily. This is useful when you switch | the formula. Place multiple =E2=80=98#+TBLFM=E2=80=99 lines right after = the table, and | then press =E2=80=98C-c C-c=E2=80=99 on the formula to apply. Here is an= example: |=20 | | x | y | | |---+---| | | 1 | | | | 2 | | | #+TBLFM: $2=3D$1*1 | #+TBLFM: $2=3D$1*2 |=20 | Pressing =E2=80=98C-c C-c=E2=80=99 in the line of =E2=80=98#+TBLFM: $2=3D= $1*2=E2=80=99 yields: |=20 | | x | y | | |---+---| | | 1 | 2 | | | 2 | 4 | | #+TBLFM: $2=3D$1*1 | #+TBLFM: $2=3D$1*2 |=20 | Note: If you recalculate this table (with =E2=80=98C-u C-c *=E2=80=99, fo= r example), you | will get the following result of applying only the first =E2=80=98#+TBLFM= =E2=80=99 line. |=20 | | x | y | | |---+---| | | 1 | 1 | | | 2 | 2 | | #+TBLFM: $2=3D$1*1 | #+TBLFM: $2=3D$1*2 `---- --=20 Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw)