VLOOKUP
Looks up a value in the first column of a table and returns a value from another column.
VLOOKUP searches vertically and returns the matching row's value from col_index_num.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
lookup_value | any | Required | — |
table_array | any (range) | Required | — |
col_index_num | number | Required | — |
range_lookup | logical | Optional | true |
Remarks
col_index_numis 1-based and must be within the table width.range_lookupdefaults toTRUE, matching Excel and LibreOffice.- When
range_lookup=TRUE, approximate match logic is used against the first column. - In exact mode, a blank candidate never matches. A blank lookup value matches a real numeric zero, but not blank, text, or boolean candidates.
- Numeric
range_lookupvalues use logical coercion: zero is exact and nonzero is approximate. - A matched empty target cell is materialized as numeric
0.
Error cases
- Approximate matching assumes the first column is sorted ascending. Unsorted data is detected and returns
#N/Arather than a silently wrong row, matching LibreOffice Calc (#283). - If the lookup value is not found, returns
#N/A. - If
col_index_numis invalid, returns#REF!(or#VALUE!if non-numeric).
Examples
Match a name in the first column and read the associated value.
Formula =VLOOKUP("Bo",{"Ana",10;"Bo",20;"Cy",30},2,FALSE)
Expected result 20
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use an approximate match on an ascending first column.
Formula =VLOOKUP(25,{10,"Low";20,"Mid";30,"High"},2,TRUE)
Expected result Mid
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Return the key from column one itself.
Formula =VLOOKUP("Ana",{"Ana",10;"Bo",20},1,FALSE)
Expected result Ana
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A missing exact-match key has no result row.
Formula =VLOOKUP("Dee",{"Ana",10;"Bo",20},2,FALSE)
Expected result #N/A
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Exact match in a key/value table
Formula =VLOOKUP("SKU-2",A1:B2,2,FALSE)
| A | B | |
|---|---|---|
| 1 | "SKU-1" | 12.5 |
| 2 | "SKU-2" | 18 |
Expected result 18
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Approximate tier lookup
Formula =VLOOKUP(3200,A1:B3,2,TRUE)
| A | B | |
|---|---|---|
| 1 | 0 | "Bronze" |
| 2 | 1000 | "Silver" |
| 3 | 5000 | "Gold" |
Expected result Silver
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What is the default behavior when range_lookup is omitted?
VLOOKUP defaults range_lookup to TRUE, so it performs approximate matching; pass FALSE or 0 for exact matching.
What happens if col_index_num points outside the table?
A numeric out-of-range column index returns #REF!, while a non-numeric col_index_num returns #VALUE!.