From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marco Wahl Subject: Re: problem with lookup, count several string in one (or more) columns. Date: Tue, 05 Jul 2016 15:47:41 +0200 Message-ID: <84lh1g5h8i.fsf@gmail.com> References: <877fd1b2h8.fsf@mat.ucm.es> <84r3b8pohn.fsf@gmail.com> <874m84gtqn.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKQhh-0002sR-4j for emacs-orgmode@gnu.org; Tue, 05 Jul 2016 09:47:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKQhd-00038n-V5 for emacs-orgmode@gnu.org; Tue, 05 Jul 2016 09:47:57 -0400 Received: from plane.gmane.org ([80.91.229.3]:35088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKQhd-00038e-Nq for emacs-orgmode@gnu.org; Tue, 05 Jul 2016 09:47:53 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bKQhc-0003Qn-1X for emacs-orgmode@gnu.org; Tue, 05 Jul 2016 15:47:52 +0200 Received: from x5f70281f.dyn.telefonica.de ([95.112.40.31]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jul 2016 15:47:52 +0200 Received: from marcowahlsoft by x5f70281f.dyn.telefonica.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jul 2016 15:47:52 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Uwe Brauer 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" '(@2$2..@-1$3) nil)) (length(org-lookup-all "MH" '(@2$2..@-1$3) 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" '(@2$2..@-1$3) nil))::@>$3='(length(org-lookup-all "NP" '(@2$2..@-2$3) nil)) Or the sightly more general formula afaics: #+TBLFM: @>>$3='(length(org-lookup-all "MH" '(@2$2..@-I$3) nil))::@>$3='(length(org-lookup-all "NP" '(@2$2..@-I$3) nil)) Best regards, -- https://marcowahl.github.io