[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
equivalent of VLOOKUP (in ods) to org-table
From: |
Uwe Brauer |
Subject: |
equivalent of VLOOKUP (in ods) to org-table |
Date: |
Sun, 08 Oct 2023 14:58:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Hi
I have regularly to deal with large tables, that I split in smaller ones and
then try to connect them.
I have to export the resulting big table to ods, and in the ods case, I have
several sheets and use the
VLOOKUP command, like this
#+begin_src
#+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 | 3 | /=VLOOKUP(final.A2,table1.$A$1:$G$3,7,FALSE())/ |
/=VLOOKUP(final.A2,table2.$A$1:$G$3,7,FALSE())/ | =SUM(C2:D2) |
| Miller | 3 | /=VLOOKUP(final.A3,table1.$A$1:$G$3,7,FALSE())/ |
/=VLOOKUP(final.A3,table2.$A$1:$G$3,5,FALSE())/ | =SUM(C3:D3) |
| Wick | 4 | /=VLOOKUP(final.A4,table1.$A$1:$G$4,7,FALSE())/ |
/=VLOOKUP(final.A4,table2.$A$1:$G$4,7,FALSE())/ | =SUM(C4:D4) |
#+TBLFM: $5=SUM(@4$3:@4$4)
#+end_src
Maybe there are other solution in ods I don't know, so the question is what is
equivalent of VLOOKUP in org.
I came up with the remote command that results in a similar result, (I did not
want to use third party packages like
orgtbl-aggregate.
#+begin_src
#+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 | 9 | 4 | 6 | 9 | 3 | 31 |
| Wick | 1 | 5 | 9 | 1 | 2 | 18 |
|--------+-----+-----+-----+-----+-----+--------|
#+TBLFM: $7=vsum($2..$6);f2
#+Name: final
| Name | Some | ResSh1 | ResSh2 | Final |
|--------+------+--------+--------+-------|
| Smith | 4 | 22 | 33 | 59 |
| Miller | 4 | 19 | 31 | 54 |
| Wick | 4 | 18 | 18 | 40 |
|--------+------+--------+--------+-------|
#+TBLFM: $3=remote(table1,@@#$7)::$4=remote(table2,@@#$7)::$5=vsum($2..$4);f2
#+end_src
The syntax with @@#$7 look cryptic to me, but I found it somewhere and it works
if somebody can suggest a simpler command that is closer to VLOOKUP I would be
grateful
Thanks and regards
Uwe Brauer
--
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/
smime.p7s
Description: S/MIME cryptographic signature
- equivalent of VLOOKUP (in ods) to org-table,
Uwe Brauer <=
- Re: equivalent of VLOOKUP (in ods) to org-table, Bruno Barbier, 2023/10/08
- Re: equivalent of VLOOKUP (in ods) to org-table, Uwe Brauer, 2023/10/08
- [the cryptic @@#$7] (was: equivalent of VLOOKUP (in ods) to org-table), Uwe Brauer, 2023/10/08
- Re: [the cryptic @@#$7] (was: equivalent of VLOOKUP (in ods) to org-table), Bruno Barbier, 2023/10/08
- Re: [the cryptic @@#$7], Uwe Brauer, 2023/10/08
- Re: [the cryptic @@#$7], Uwe Brauer, 2023/10/11
- Re: [the cryptic @@#$7], Bruno Barbier, 2023/10/12
- Re: [the cryptic @@#$7], Uwe Brauer, 2023/10/12
- Re: equivalent of VLOOKUP (in ods) to org-table, Bruno Barbier, 2023/10/08
- Re: equivalent of VLOOKUP (in ods) to org-table, Uwe Brauer, 2023/10/08