From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shankar Rao Subject: Re: Recursive formulaes in org-mode tables Date: Tue, 13 Oct 2015 10:17:50 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b4728821fb9840521ffa00c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm3Cy-0004qF-Va for emacs-orgmode@gnu.org; Tue, 13 Oct 2015 13:17:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zm3Cx-00030c-I4 for emacs-orgmode@gnu.org; Tue, 13 Oct 2015 13:17:52 -0400 Received: from mail-ob0-x230.google.com ([2607:f8b0:4003:c01::230]:35199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm3Cx-00030Y-Br for emacs-orgmode@gnu.org; Tue, 13 Oct 2015 13:17:51 -0400 Received: by obbzf10 with SMTP id zf10so19241651obb.2 for ; Tue, 13 Oct 2015 10:17:50 -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: michael.zombok@googlemail.com Cc: emacs-orgmode@gnu.org --047d7b4728821fb9840521ffa00c Content-Type: text/plain; charset=UTF-8 I posted the following on Stack Overflow: I recommend using the following range formula: | Year (Beginn) | Price | Increase | |---------------+----------+----------| | 2016 | 20000.00 | 1000.00 | | 2017 | | 1000.00 | | 2018 | | 1000.00 | | 2019 | | 1000.00 | | 2020 | | 1000.00 | | 2021 | | 1000.00 | | 2022 | | 1000.00 | | 2023 | | 1000.00 | | 2024 | | 1000.00 | | 2025 | | 1000.00 | | 2026 | | 1000.00 | | 2027 | | 1000.00 | | 2028 | | 1000.00 | | 2029 | | 1000.00 | | 2030 | | 1000.00 | |---------------+----------+----------| #+TBLFM: @<<<$2..@>$2=@<<$0+2*vsum(@<<$3..@-1$3);%.2f You could write a recursive formula, but that would propagate one row at a time. Even org-table-iterate (C-u C-u C-c * on any table cell) would have to be called more than once, since it stops after 10 iterations. Shankar Rao On Tue, Oct 13, 2015 at 8:35 AM, wrote: > Hi, > > I have the following table: > > | Year (Beginn) | Price | Increase | > |---------------+----------+----------| > | 2016 | 20000.00 | 1000.00 | > | 2017 | | 1000.00 | > | 2018 | | 1000.00 | > | 2019 | | 1000.00 | > | 2020 | | 1000.00 | > | 2021 | | 1000.00 | > | 2022 | | 1000.00 | > | 2023 | | 1000.00 | > | 2024 | | 1000.00 | > | 2025 | | 1000.00 | > | 2026 | | 1000.00 | > | 2027 | | 1000.00 | > | 2028 | | 1000.00 | > | 2029 | | 1000.00 | > | 2030 | | 1000.00 | > |---------------+----------+----------| > > I want to compute the price recursively such that the final table looks > like this: > > | Year (Beginn) | Price | Increase | > |---------------+----------+----------| > | 2016 | 20000.00 | 1000.00 | > | 2017 | 22000.00 | 1000.00 | > | 2018 | 24000.00 | 1000.00 | > | 2019 | 26000.00 | 1000.00 | > | 2020 | 28000.00 | 1000.00 | > | 2021 | 30000.00 | 1000.00 | > | 2022 | 32000.00 | 1000.00 | > | 2023 | 34000.00 | 1000.00 | > | 2024 | 36000.00 | 1000.00 | > | 2025 | 38000.00 | 1000.00 | > | 2026 | 40000.00 | 1000.00 | > | 2027 | 42000.00 | 1000.00 | > | 2028 | 44000.00 | 1000.00 | > | 2029 | 46000.00 | 1000.00 | > | 2030 | 48000.00 | 1000.00 | > |---------------+----------+----------| > After reading a related SO question I tried the formula > > #+TBLFM: @<<<..>$2=@<<..>>$2+2*$3 > > but it doesn't work. It gives an error and also seems to operate on > column one instead of the specified column two. Any idea how to > correctly compute column two? I am using org-mode version 8.2.5c with > Emacs version 24.5.1. > > Disclaimer: I posted this question also on Stack Overflow: > > > http://stackoverflow.com/questions/33063425/recursive-formulaes-in-org-mode-tables > > Feel free to answer here or there. > > Thanks! > > Best, > Michael > > > --047d7b4728821fb9840521ffa00c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I posted the following on Stack Overflow:

I recommend using the following range formula:

=
| Year (Beginn) | =C2=A0 =C2=A0Pri= ce | Increase |
|-----= ----------+----------+----------|
| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A02016 | 20000.00 | =C2=A0100= 0.00 |
| =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A02017 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.= 00 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02018 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02019 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02020 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02021 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02022 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02023 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02024 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02025 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02026 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02027 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02028 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02029 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02030 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A01000.0= 0 |
|---------------+-= ---------+----------|
= #+TBLFM: @<<<$2..@>$2=3D@<<$0+2*vsum(@<<$3..@-1$3);= %.2f

You could write a recursive formula, b= ut that would propagate one row at a time. Even org-table-iterate (C-u C-u = C-c * on any table cell) would have to be called more than once, since it s= tops after 10 iterations.

Shankar Rao


On Tue, Oct 13, 2015 at 8:35 AM, <<= a href=3D"mailto:michael.zombok@googlemail.com" target=3D"_blank">michael.z= ombok@googlemail.com> wrote:
http://stackoverfl= ow.com/questions/33063425/recursive-formulaes-in-org-mode-tables

Feel free to answer here or there.

Thanks!

Best,
Michael



--047d7b4728821fb9840521ffa00c--