[]
        
(Showing Draft Content)

HLOOKUP

This function searches for a value in the top row and then returns a value in the same column from a specified row.

Syntax

HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

Arguments

This function has these arguments:

Argument

Description

lookup_value

The value to search for in the first row 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 row of the range contains the values to search.

row_index_num

The row number in table_array from which to return a value. The first row of table_array is row 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 row 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 row 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 row_index_num is less than 1, the function returns the #VALUE! error.

  • If row_index_num is greater than the number of rows 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

activeSheet.setFormula(1, 8, '=HLOOKUP("Current",A1:G33,3,FALSE)');
activeSheet.setFormula(3, 8, '=HLOOKUP(B6,A1:F4,4,TRUE)');