[]
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.
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
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 |
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.
Accepts numeric data, string data, Boolean data, and cell references.
Returns numeric data, string data, Boolean data, or an error value.
activeSheet.setFormula(0, 5, '=VLOOKUP(E1,A1:C10,3,FALSE)');
activeSheet.setFormula(1, 5, '=VLOOKUP(E2,A1:C10,2,TRUE)');