From: Bruno Barbier <brubar.cs@gmail.com>
To: Uwe Brauer <oub@mat.ucm.es>, emacs-orgmode@gnu.org
Subject: Re: how to exclude certain row values from calculation in a table
Date: Mon, 06 Nov 2023 19:46:49 +0100 [thread overview]
Message-ID: <6549349a.5d0a0220.f89cb.1866@mx.google.com> (raw)
In-Reply-To: <87sf5i3mob.fsf@mat.ucm.es>
Hi Uwe,
Uwe Brauer <oub@mat.ucm.es> writes:
> Hi all
>
> Please look at
>
> | | Price |
> |---+--------|
> | / | 10.98 |
> | | 11.90 |
> | | 19.98 |
> | | 13.79 |
> | | 29.97 |
> | | 18.98 |
> | | 13.79 |
> | | 11.90 |
> | | 24.28 |
> |---+--------|
> | | 155.57 |
> #+TBLFM: @11$2=vsum(@I$2..@II$2);f2
>
> I would like to exclude the first value from the sum by adding some mark
> in that row.
...
>
> Any idea how to exclude row values in a column?
You could use 'vmask' to mask the values you don't want.
Here is an example using vmask:
| | Price |
|----------------+--------|
| 1 | 10.98 |
| | 11.90 |
| | 19.98 |
| | 13.79 |
| 1 | 29.97 |
| | 18.98 |
| | 13.79 |
| | 11.90 |
| | 24.28 |
|----------------+--------|
| | 155.57 |
| Total unmarked | 114.62 |
| Total marked | 40.95 |
| Check all | OK |
#+TBLFM: @11$2=vsum(@I$2..@II$2);f2
#+TBLFM: @12$2=vsum(vmask(map(<0 = #1>, @I$1..@II$1), @I$2..@II$2));f2NE
#+TBLFM: @13$2=vsum(vmask(map(<1 = #1>, @I$1..@II$1), @I$2..@II$2));f2NE
#+TBLFM: @14$2=string(if(@12$2+@13$2 = @11$2, "OK", "Oops!"))
Bruno
next prev parent reply other threads:[~2023-11-06 18:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 15:51 how to exclude certain row values from calculation in a table Uwe Brauer
2023-11-06 18:46 ` Bruno Barbier [this message]
2023-11-06 19:58 ` 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=6549349a.5d0a0220.f89cb.1866@mx.google.com \
--to=brubar.cs@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=oub@mat.ucm.es \
/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).