vLookUp() Function

1. Overview

The vLookUp() function searches for a value v in the leftmost column of an array. If a match is found, it returns the value from the same row and the n‑th column of that array.

2. Function Syntax

vLookUp(v, array, n, [type])

vLookUp(v, array, n, [type], [startIndex], [occurrence])

2.1 Parameters

If type is omitted, it defaults to 1.

3. Search Types and SEARCH:: Flags

3.1 Basic Types

3.2 SEARCH:: Flags

3.3 Equivalences

3.4 Restrictions

3.5 Important Notes

If SEARCH::SortAscending or SEARCH::SortDescending is specified, the searched range must not contain formulas that break the sort order during recalculation. In such cases, circular references are not reported for cells other than the result cell.

Binary searches enabled by SortAscending or SortDescending are typically tens or hundreds of times faster than plain linear searches.

3.6 AutoSort

If SEARCH::AutoSort is specified, GS-Calc creates and maintains sort indices for unsorted ranges. These internal indices allow quick binary searches without requiring manual sorting. All indices are created during the first update and then updated as needed.

The speed gain depends on how many vLookUp() formulas are present, how often ranges are reused, and how large the searched ranges are. For very large worksheets, performance can improve by hundreds of times.

SEARCH::AutoSort must be used together with SEARCH::SortAscending or SEARCH::SortDescending. If the data is already partially sorted, use the sort order flag that best matches that partial sorting.

3.7 MixedData

If SEARCH::MixedData is specified, the searched range is assumed to contain both numeric and text cells:

If sorting flags are used with MixedData, the range must be sorted using a mixed text/numeric method. With AutoSort, GS-Calc handles this internally, but it may significantly slow down sorting. Otherwise, use the options in Tools → Sort Cell Range.

3.8 Numeric Codes

For workbooks containing extremely large numbers of vLookUp() functions, you can use the numeric sum of flags instead of individual names to specify the type argument.

If no match is found, vLookUp() returns the #N/A! error value.

4. Examples

=vLookUp(2, {1, 2, 3; "a", "b", "c"}, 2, 0) → "b"

=vLookUp(2.5, {1, 2, 3; "a", "b", "c"}, 2, -1) → "c"

=vLookUp(2.5, {1, 2, 3; "a", "b", "c"}, 2, 1) → "b"

=vLookUp("*bc??", {"abc", "abcde", "ac"; 1, 2, 3}, 2, 0) → 2

=vLookUp(2.5, sheet1!b5:d10000, 2, SEARCH::SortAscending + SEARCH::MatchNotGreater)

=vLookUp("bc\\d", {"abc", 1; "abcde", 2; "abc10", 3}, 2, SEARCH::RegEx) → 3

5. Inserting vLookUp() via the Menu

You can insert the vLookUp() function with two clicks using:

Insert → VLOOKUP()

The “Insert VLOOKUP()” dialog determines optimal parameters, presets all options, and automatically creates the formula.

Insert VLOOKUP dialog

The source range 16‑element list is stored globally in the settings file. Subsequent source ranges are added in a circular manner using:

Copy as Location (menu command)

Copy as Location

Enter (toolbar button

Enter toolbar button