Hi Karl
On Mon, Oct 1, 2018 at 5:02 PM Karl Voit <[email protected]> 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
Michael