emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Uwe Brauer <oub@mat.ucm.es>, emacs-orgmode@gnu.org
Subject: Re: equivalent of VLOOKUP (in ods) to org-table
Date: Sun, 08 Oct 2023 18:42:37 +0200	[thread overview]
Message-ID: <6522dbff.df0a0220.53465.d25c@mx.google.com> (raw)
In-Reply-To: <87h6n1i84d.fsf@mat.ucm.es>


Hi Uwe,

Uwe Brauer <oub@mat.ucm.es> writes:
> so the question is what is equivalent of VLOOKUP in org.

Did you check these lookup functions in the Org manual?

   (info "(org) Lookup functions")


Bruno.



>
> 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/


  reply	other threads:[~2023-10-08 16:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08 12:58 equivalent of VLOOKUP (in ods) to org-table Uwe Brauer
2023-10-08 16:42 ` Bruno Barbier [this message]
2023-10-08 16:49   ` Uwe Brauer
2023-10-08 16:59     ` [the cryptic @@#$7] (was: equivalent of VLOOKUP (in ods) to org-table) Uwe Brauer
2023-10-08 17:30       ` Bruno Barbier
2023-10-08 17:46         ` [the cryptic @@#$7] Uwe Brauer
2023-10-11 15:01         ` Uwe Brauer
2023-10-12 13:21           ` Bruno Barbier
2023-10-12 14:40             ` Uwe Brauer
2023-10-08 17:11     ` equivalent of VLOOKUP (in ods) to org-table Bruno Barbier
2023-10-08 17:45       ` 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=6522dbff.df0a0220.53465.d25c@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).