emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] problem with lookup, count several string in one (or more) colum


From: Marco Wahl
Subject: Re: [O] problem with lookup, count several string in one (or more) columns.
Date: Tue, 05 Jul 2016 15:47:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Uwe Brauer <address@hidden> writes:

> You mean
>
> | group | round 1 | round 2 |
> |-------+---------+---------|
> | A     |         |     2.4 |
> | B     | 4.7     |      11 |
> | C     |         |      MH |
> | D     | 5       |         |
> | E     |         |     7.2 |
> | F     | 3.2     |     4.3 |
> | G     | NP      |     4.4 |
> | H     | NP      |       8 |
> | I     | NP      |       8 |
> |-------+---------+---------|
> | total | MH      |       4 |
>
> #+TBLFM: @>$3='(+ (length(org-lookup-all "NP" '(@address@hidden) nil)) 
> (length(org-lookup-all "MH" '(@address@hidden) nil)));

Yes.

> That gives
>
> | total | MH      |  4       |

Agreed.

> But I want
>
> | total | MH | 1 |
> | total | NP | 3 |

Okay.

What about the following?

 | group | round 1 | round 2 |
 |-------+---------+---------|
 | A     |         |     2.4 |
 | B     | 4.7     |      11 |
 | C     |         |      MH |
 | D     | 5       |         |
 | E     |         |     7.2 |
 | F     | 3.2     |     4.3 |
 | G     | NP      |     4.4 |
 | H     | NP      |       8 |
 | I     | NP      |       8 |
 |-------+---------+---------|
 | total | MH      |         |
 | total | NP      |         |
#+TBLFM: @>>$3='(length(org-lookup-all "MH" '(@address@hidden) 
nil))::@>$3='(length(org-lookup-all "NP" '(@address@hidden) nil))

Or the sightly more general formula afaics:

#+TBLFM: @>>$3='(length(org-lookup-all "MH" '(@address@hidden) 
nil))::@>$3='(length(org-lookup-all "NP" '(@address@hidden) nil))


Best regards,
--
https://marcowahl.github.io





reply via email to

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