[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Calculate differences of remote table numbers
From: |
Karl Voit |
Subject: |
Re: [O] Calculate differences of remote table numbers |
Date: |
Mon, 8 Oct 2018 17:19:20 +0200 |
User-agent: |
slrn/pre1.0.0-18 (Linux) |
* Michael Brand <address@hidden> wrote:
> Hi Karl
Hi Michael,
> On Mon, Oct 1, 2018 at 5:02 PM Karl Voit <address@hidden> wrote:
>
>> I'd like to calculate the differences between rows of numbers of a
>> different table.
>
> For this kind of shifting row or column indexes I use Calc vector
> subscript. In your case:
>
> #+NAME: my-table
>| Numbers |
>|---------|
>| 1 |
>| 5 |
>| 8 |
>| 12 |
>| 15 |
>
>| Line | Difference |
>|------+------------|
>| 1 | |
>| 2 | 4 |
>| 3 | 3 |
>| 4 | 4 |
>| 5 | 3 |
> #+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table,
> @address@hidden), @# - 1) - subscr(remote(my-table, @address@hidden), @# - 2))
>
> or, avoiding @# completely in the formula for $2:
>
> #+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table,
> @address@hidden), $1) - subscr(remote(my-table, @address@hidden), $1 - 1))
>
> See also a similar example of subscr in the subsection "Dynamic
> variation of ranges" here:
> https://orgmode.org/worg/org-hacks.html#field-coordinates-in-formulas
Thanks for your post - it is working as expected! \o/
Also thanks for the URL - I added it to my knowledge base.
Unfortunately, I have to admit that spreadsheets in Org are not
something I can recommend to somebody who needs "something that just
works" (like Excel-switcher). :-(
However, when a table is finally working as expected, I really do
appreciate having this table (and its derived data) within my notes
and not locked away in a separate file.
--
get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
Personal Information Management > http://Karl-Voit.at/tags/pim/
Emacs-related > http://Karl-Voit.at/tags/emacs/