* Michael Brand <michael.ch.br...@gmail.com> wrote:
> Hi Karl

Hi Michael,

> On Mon, Oct 1, 2018 at 5:02 PM Karl Voit <devn...@karl-voit.at> 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,
> @I$1..@II$1), @# - 1) - subscr(remote(my-table, @I$1..@II$1), @# - 2))
>
> or, avoiding @# completely in the formula for $2:
>
> #+TBLFM: $2 = if($1 == 1, string(""), subscr(remote(my-table,
> @I$1..@II$1), $1) - subscr(remote(my-table, @I$1..@II$1), $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/


Reply via email to