emacs-orgmode
[Top][All Lists]
Advanced

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

Re: equivalent of VLOOKUP (in ods) to org-table


From: Bruno Barbier
Subject: Re: equivalent of VLOOKUP (in ods) to org-table
Date: Sun, 08 Oct 2023 19:11:51 +0200

Uwe Brauer <oub@mat.ucm.es> writes:

>>>> "BB" == Bruno Barbier <brubar.cs@gmail.com> writes:
>> Did you check these lookup functions in the Org manual?
>>    (info "(org) Lookup functions")
>
>
> Yes of course, but I am unable to obtain the same result as I do using
> the remote call.

Did you try something like this ?

   #+NAME: table1
   | Name   | Ex1 | Ex2 | Ex2 | Ex4 | Ex5 | ResSh1 |
   |--------+-----+-----+-----+-----+-----+--------|
   | Smith  |   2 |   3 |   4 |   6 |   7 |     22 |
   | Miller |   2 |  10 |   1 |   1 |   5 |     19 |
   | Wick   |   1 |   2 |   3 |  10 |   2 |     18 |
   #+TBLFM: $7=vsum($2..$6);f2


   #+NAME: table2   
   | Name   | Ex1 | Ex2 | Ex2 | Ex4 | Ex5 | ResSh2 |
   |--------+-----+-----+-----+-----+-----+--------|
   | Smith  |   8 |   3 |   5 |   8 |   9 |     33 |
   | Miller |   2 |   1 |   6 |   9 |   3 |     21 |
   | Wick   |   1 |   5 |   9 |   1 |   2 |     18 |
   #+TBLFM: $7=vsum($2..$6);f2

   | Name   |   | ResSh1 | ResSh2 | Total |
   |--------+---+--------+--------+-------|
   | Smith  | 4 |     22 |     33 |    59 |
   | Miller | 4 |     19 |     21 |    44 |
   | Wick   | 4 |     18 |     18 |    40 |
   #+TBLFM: $3='(org-lookup-first $1 '(remote(table1, @I$1..@II$1)) 
'(remote(table1, @I$7..@II$7)))
   #+TBLFM: $5=vsum($2..$4)

IIUC, it seems to be the result that you're expecting.

Bruno


>
> Uwe 
> -- 
> Warning: Content may be disturbing to some audiences
> I strongly condemn Putin's war of aggression against Ukraine.
> I support to deliver weapons to Ukraine's military. 
> I support the NATO membership of Ukraine.
> I support the EU membership of Ukraine. 
> https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/



reply via email to

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