Index Match
2023-05-21The INDEX MATCH formula is a combination of two separate functions in Excel and it's often used as a more flexible alternative to the VLOOKUP or HLOOKUP functions. Here's how they work:
- INDEX: Returns a value from a specific location in a table or range.
- MATCH: Returns the position of a value in a specific range.
Combined, the INDEX MATCH formula can return the value at a specified location within a range. Here's the basic syntax:
=INDEX(array, MATCH(lookup_value, lookup_array, match_type))
Here's how you'd use each component:
- array: This is the range of cells from which you want to retrieve a value. It is typically a column or row, but it can be a larger 2D range of cells if needed (INDEX MATCH MATCH is the better option here).
- lookup_value: This is the value you want to find in your lookup_array.
- lookup_array: This is the range of cells in which you want to find the lookup_value.
- match_type: This is an optional argument that specifies how you want to match your lookup_value. -1 means less than, 0 means exactly equal to, and 1 means greater than.
Here's an example of how it might be used. Let's say you have the following table:
ID | Name | |
---|---|---|
1 | 123 | John |
2 | 456 | Jane |
3 | 789 | Sam |
If you want to find out the name associated with ID 456, you can use the INDEX MATCH formula like this:
=INDEX(C2:C4, MATCH(456, B2:B4, 0))
This formula would return Jane because Jane is in the position (row) in the C column that matches where 456 is found in the B column.
The advantage of INDEX MATCH over functions like VLOOKUP is that it doesn't require the lookup column to be to the left of the return value column. It also handles columns getting inserted or deleted in your table without breaking, and is generally more flexible.