From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: Re: how to add a range of columns
Date: Fri, 02 Jul 2021 20:56:38 +0200 [thread overview]
Message-ID: <87r1ggfst5.fsf@mat.ucm.es> (raw)
In-Reply-To: 878s2oeoq0.fsf@disroot.org
[-- Attachment #1: Type: text/plain, Size: 2868 bytes --]
>>> "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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
next prev parent reply other threads:[~2021-07-02 18:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 8:42 how to add a range of columns Uwe Brauer
2021-07-02 9:10 ` Eric S Fraga
2021-07-02 9:23 ` Uwe Brauer
2021-07-02 9:46 ` Eric S Fraga
2021-07-02 10:04 ` Uwe Brauer
2021-07-02 10:37 ` Eric S Fraga
2021-07-02 14:07 ` Uwe Brauer
2021-07-02 15:10 ` Eric S Fraga
2021-07-02 18:56 ` Uwe Brauer [this message]
2021-07-03 7:29 ` Eric S Fraga
2021-07-04 12:37 ` Uwe Brauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1ggfst5.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).