How to Use the INDEX and MATCH Function in Excel
How to Use the INDEX and MATCH Function in Excel GA S REGULAR Menu Lifewire Tech for Humans Newsletter! Search Close GO Software & Apps > MS Office 25 25 people found this article helpful
=INDEX(A1:B1,1)
=INDEX(2:2,1)
=INDEX(B1:B2,1) In this first example, there are four INDEX formulas we can use to get different values: =INDEX(A1:B2,2,2) looks through A1:B2 to find the value in the second column and second row, which is Stacy.=INDEX(A1:B1,1) looks through A1:B1 to find the value in the first column, which is Jon.=INDEX(2:2,1) looks through everything in the second row to locate the value in the first column, which is Tim.=INDEX(B1:B2,1) looks through B1:B2 to locate the value in the first row, which is Amy.
=MATCH(14,D1:D2)
=MATCH(14,D1:D2,-1)
=MATCH(13,A1:D1,0) Here are four easy examples of the MATCH function: =MATCH("Stacy",A2:D2,0) is searching for Stacy in the range A2:D2 and returns 3 as the result.=MATCH(14,D1:D2) is searching for 14 in the range D1:D2, but since it's not found in the table, MATCH finds the next largest value that's less than or equal to 14, which in this case is 13, which is in position 1 of lookup_array.=MATCH(14,D1:D2,-1) is identical to the formula above it, but since the array isn't in descending order like -1 requires, we get an error.=MATCH(13,A1:D1,0) is looking for 13 in the first row of the sheet, which returns 4 since it's the fourth item in this array.
How to Use the INDEX and MATCH Function in Excel
Discover the potential of the powerful lookup combo
By Tim Fisher Tim Fisher Senior Vice President & Group General Manager, Tech & Sustainability Emporia State University Tim Fisher has more than 30 years' of professional technology experience. He's been writing about tech for more than two decades and serves as the VP and General Manager of Lifewire. lifewire's editorial guidelines Updated on January 6, 2021 Reviewed by Ryan Perian Reviewed by Ryan Perian Western Governors University Ryan Perian is a certified IT specialist who holds numerous IT certifications and has 12+ years' experience working in the IT industry support and management positions. lifewire's editorial guidelines Tweet Share Email Tweet Share Email MS Office Excel Word Powerpoint OutlookWhat to Know
The INDEX function can be used alone, but nesting the MATCH function inside it creates an advanced lookup.This nested function is more flexible than VLOOKUP and can yield results faster. This article explains how to use the INDEX and MATCH functions together in all versions of Excel, including Excel 2019 and Microsoft 365.What Are the INDEX and MATCH functions
INDEX and MATCH are Excel lookup functions. While they are two entirely separate functions that can be used on their own, they can also be combined to create advanced formulas. The INDEX function returns a value or the reference to a value from within a particular selection. For example, it could be used to find the value in the second row of a data set, or in the fifth row and third column. While INDEX could very well be used alone, nesting MATCH in the formula makes it a bit more useful. The MATCH function searches for a specified item in a range of cells and then returns the relative position of the item in the range. For example, it could be used to determine that a specific name is the third item in a list of names.INDEX and MATCH Syntax & Arguments
This is how both functions need to be written in order for Excel to understand them: =INDEX(array, row_num, [column_num]) array is the range of cells that the formula will be using. It can be one or more rows and columns, such as A1:D5. It's required.row_num is the row in the array from which to return a value, such as 2 or 18. It's required unless column_num is present.column_num is the column in the array from which to return a value, such as 1 or 9. It's optional. =MATCH(lookup_value, lookup_array, [match_type]) lookup_value is the value you want to match in lookup_array. It can be a number, text, or logical value that's typed manually or referred to via a cell reference. This is required. lookup_array is the range of cells to look through. It can be a single row or a single column, such as A2:D2 or G1:G45. This is required. match_type can be -1, 0, or 1. It specifies how lookup_value is matched with values in lookup_array (see below). 1 is the default value if this argument is omitted. Which Match Type to Use Match Type What It Does Rule Example 1 Finds the largest value that's less than or equal to lookup_value. The lookup_array values must be placed in ascending order (e.g., -2, -1, 0, 1, 2; or A-Z;, or FALSE, TRUE. lookup_value is 25 but it's missing from lookup_array, so the position of the next smallest number, like 22, is returned instead. 0 Finds the first value that's exactly equal to lookup_value. The lookup_array values can be in any order. lookup_value is 25, so it returns the position of 25. -1 Finds the smallest value that's greater or equal to lookup_value. The lookup_array values must be placed in descending order (e.g., 2, 1, 0, -1, -2). lookup_value is 25 but it's missing from lookup_array, so the position of the next largest number, like 34, is returned instead. Use 1 or -1 for times when you need to run an approximate lookup along a scale, like when dealing with numbers and when approximations are okay. But remember that if you don't specify match_type, 1 will be the default, which can skew the results if you're really wanting an exact match.Example INDEX and MATCH Formulas
Before we look at how to combine INDEX and MATCH into one formula, we need to understand how these functions work on their own.INDEX Examples
=INDEX(A1:B2,2,2)=INDEX(A1:B1,1)
=INDEX(2:2,1)
=INDEX(B1:B2,1) In this first example, there are four INDEX formulas we can use to get different values: =INDEX(A1:B2,2,2) looks through A1:B2 to find the value in the second column and second row, which is Stacy.=INDEX(A1:B1,1) looks through A1:B1 to find the value in the first column, which is Jon.=INDEX(2:2,1) looks through everything in the second row to locate the value in the first column, which is Tim.=INDEX(B1:B2,1) looks through B1:B2 to locate the value in the first row, which is Amy.
MATCH Examples
=MATCH("Stacy",A2:D2,0)=MATCH(14,D1:D2)
=MATCH(14,D1:D2,-1)
=MATCH(13,A1:D1,0) Here are four easy examples of the MATCH function: =MATCH("Stacy",A2:D2,0) is searching for Stacy in the range A2:D2 and returns 3 as the result.=MATCH(14,D1:D2) is searching for 14 in the range D1:D2, but since it's not found in the table, MATCH finds the next largest value that's less than or equal to 14, which in this case is 13, which is in position 1 of lookup_array.=MATCH(14,D1:D2,-1) is identical to the formula above it, but since the array isn't in descending order like -1 requires, we get an error.=MATCH(13,A1:D1,0) is looking for 13 in the first row of the sheet, which returns 4 since it's the fourth item in this array.