This is the official manual for the latest Org-mode release.
Org has three predefined Emacs Lisp functions for lookups in tables.
(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)
(PREDICATE VAL S)
t; returns the value from the corresponding position in list
R-LIST. The default
equal. Note that the
S are passed to
PREDICATE in the same
order as the corresponding parameters are in the call to
nil, the matching element
(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)
org-lookup-firstabove, but searches for the last element for which
(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)
org-lookup-first, but searches for all elements for which
t, and returns all corresponding values. This function can not be used by itself in a formula, because it returns a list of values. However, powerful lookups can be built when this function is combined with other Emacs Lisp functions.
If the ranges used in these functions contain empty fields, the
for the formula should usually be specified: otherwise empty fields will not be
R-LIST which can, for example, result
in an incorrect mapping from an element of
S-LIST to the corresponding
These three functions can be used to implement associative arrays, count matching cells, rank results, group data etc. For practical examples see this tutorial on Worg.