LOOKUP
The LOOKUP function sequentially searches a series, returning the first member of the series that meets a specified condition.
- Syntax:
- LOOKUP (series-object-expression , single-condition-expression)
- Meaning:
- LOOKUP (series_to_search , condition_to_evaluate)
- Returns:
- A single object
LOOKUP returns the first member of series_to_search for which condition_to_evaluate evaluates to "true"; it returns "none" if no member of series_to_search meets the condition specified by condition_to_evaluate.
Examples
- LOOKUP (Account#:Customer , Company Name:Customer =
"ACME")
This example returns the Account# of Customer whose Company Name is ACME.
- LOOKUP (Part#:Row:DBSelect , Model#:Row:DBSelect =
ModelCode:Legacy & Serial#:Row:DBSelect > "123")
This example returns the Part# of DBSelect where the Model# in that row matches the ModelCode of Legacy and the Serial# is greater than 123.
Related functions
- CHOOSE
- EXTRACT Note: LOOKUP differs from EXTRACT in that LOOKUP returns the first member of series_to_search that meets the condition_to_evaluate, while EXTRACT returns all members (one at a time) of series_to_search that meet the condition_to_evaluate.
- LOOKDOWNNote: LOOKUP differs from LOOKDOWN in that LOOKUP returns the first member of series_to_search that meets the condition_to_evaluate, while LOOKDOWN returns the last member of series_to_search that meets the condition_to_evaluate.
- SEARCHUP
- SEARCHDOWN
The LOOKUP function performs a sequential search on an unsorted series, starting from the beginning of the series. The SEARCHUP and SEARCHDOWN functions perform a binary search on a series that is sorted in ascending or descending code-page byte-order. The SEARCHUP and SEARCHDOWN functions are efficient for performing multiple searches on a large series. The LOOKUP function can be more efficient for performing fewer searches.