# VLOOKUP

## Content

This function searches for a value in the first column of a table and returns a value from the same row in a specified column.

## Syntax

`VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])`

## Arguments

This function has the following arguments:

| **Argument** | **Description** |
| -------- | ----------- |
| *lookup\_value* | The value to search for in the first column of *table\_array*. The value can be a value or a cell reference. |
| *table\_array* | The cell range that contains the lookup data. The first column of the range contains the values to search. |
| *col\_index\_num* | The column number in *table\_array* from which to return a value. The first column of *table\_array* is column 1. |
| *range\_lookup* | [Optional] A Boolean value that specifies the matching method. Specify `FALSE` for an exact match or `TRUE` for an approximate match. The default value is `TRUE`. |

## Remarks

* If *range\_lookup* is `TRUE` or omitted, the values in the first column of *table\_array* should be sorted in ascending order. If an exact match is not found, the function returns the largest value that is less than or equal to *lookup\_value*.
* If *range\_lookup* is `FALSE`, the values in the first column do not need to be sorted. If no exact match is found, the function returns the `#N/A` error.
* When *range\_lookup* is `FALSE` and *lookup\_value* is text, you can use the question mark (`?`) and asterisk (`*`) wildcard characters. To search for an actual question mark or asterisk, type a tilde (`~`) before the character.
* Text comparisons are not case-sensitive.
* If *col\_index\_num* is less than 1, the function returns the `#VALUE!` error.
* If *col\_index\_num* is greater than the number of columns in *table\_array*, the function returns the `#REF!` error.

## Data Types

Accepts numeric data, string data, Boolean data, and cell references. 
Returns numeric data, string data, Boolean data, or an error value.

## Examples

```auto
activeSheet.setFormula(0, 5, '=VLOOKUP(E1,A1:C10,3,FALSE)');
activeSheet.setFormula(1, 5, '=VLOOKUP(E2,A1:C10,2,TRUE)');
```