emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to add a range of columns


From: Uwe Brauer
Subject: Re: how to add a range of columns
Date: Fri, 02 Jul 2021 20:56:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Friday,  2 Jul 2021 at 16:07, Uwe Brauer wrote:
>> The problem is the target @<<$3..@>>$3
>> 
>> There seems no option to specify such a range.

> Sorry, I didn't explain myself properly.  You can specify which rows
> should be calculated automatically so that you can then use a simple
> column formula without it extending to the full column:

> #+begin_src org
>   ,#+Name: check
>   |   | User1 | User2 | Result |
>   |---+-------+-------+--------|
>   | # |     1 |     3 |      4 |
>   | # |     4 |     8 |     12 |
>   | # |    10 |     3 |     13 |
>   |---+-------+-------+--------|
>   |   |     7 |     9 |        |
>   ,#+TBLFM: $4=$2+$3
> #+end_src


> If you type "C-u C-c *" to re-calculate the table, the last entry in the
> 4th column is not updated even though the expression says that column 4
> is the sum of columns 2 and 3.

> Once you start using some of these advanced features, you can make your
> formulas easier to read, e.g.:

> #+begin_src org
>   ,#+Name: check2
>   | ! | User1 | User2 | Result |
>   |---+-------+-------+--------|
>   | # |     1 |     3 |      4 |
>   | # |     4 |     8 |     12 |
>   | # |    10 |     3 |     13 |
>   |---+-------+-------+--------|
>   |   |     7 |     9 |        |
>   ,#+TBLFM: $4=$User1+$User2
> #+end_src

Thanks, I thought of that 

#+begin_src elisp
#+Name: check3
  |   | User1 | User2 | Result |
  |---+-------+-------+--------|
  |   |     1 |     3 | 4      |
  |   |     4 |     8 | 12     |
  |   |    10 |     3 | 13     |
  |---+-------+-------+--------|
  | / |     7 |     9 |        |
#+TBLFM: $4=$2+$3
#+end_src
which is a bit the antipode of your approach.

It just occurred to me that this approach has its limitations, let's go
step further 

#+begin_src elisp
#+Name: check2
  | ! | User1 | User2 | Result | New | Actual |
  |---+-------+-------+--------+-----+--------|
  | # |     1 |     3 |      4 |   6 |        |
  | # |     4 |     8 |     12 |   9 |        |
  | # |    10 |     3 |     13 |  10 |        |
  |---+-------+-------+--------+-----+--------|
  |   |     7 |     9 |        |     |        |
#+TBLFM: $4=$User1+$User2
#+end_src


Now I want to add also result and new, but only the first two rows, the
only way to do it seems to be your original approach.


#+begin_src elisp

#+Name: check2
  | ! | User1 | User2 | Result | New | Actual |
  |---+-------+-------+--------+-----+--------|
  | # |     1 |     3 |      4 |   6 |     10 |
  | # |     4 |     8 |     12 |   9 |     21 |
  | # |    10 |     3 |     13 |  10 |        |
  |---+-------+-------+--------+-----+--------|
  |   |     7 |     9 |        |     |        |
#+TBLFM: $4=$User1+$User2::@<<$6..@>>>$6=$4+$5
#+end_src

Regards

Uwe 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]