The MATCH Function looks up a value you designate within a group of values and returns the position of that value within the group. A workhorse in data processing and dashboard construction.
The MATCH function is a computer program that you run from a worksheet cell formula. It looks up a value you designate within a group of values and returns the position of that value within the group. The group of values being scanned are generally located in a given worksheet area (called a range). You run the MATCH worksheet function by typing its name in a formula then followed by the information it is suppose to use. The MATCH worksheet function is generally not used by itself. It is generally used to return some position so another function or formula can use that information. The match function is very commonly used with the INDEX worksheet function as a replacement for the VLOOKUP function (refer to INDEX for further information). MATCH generally scans a single worksheet row or column to find the position of name, number, date...etc. Remember though the position returned is relative to the range start and end which means if you look at a range C3:C10 and find Widget3 in C3, MATCH returns 1 because cell C3 is the first cell in the range being scanned. If the range started at C1 then it would return 3 because it is the 3 cells down.
Whenever you type a formula in a worksheet cell, this is called syntax or grammar. The general MATCH function syntax has a format like this when you type it in a worksheet cell:
Where lookup_value, lookup_array, [match_type] are called the function argument list. Remember, you are running a computer program at this point so the program needs information to operate and that is why there is an argument list. When you see an argument list and you see square brackets [ ] around the argument name, this means the argument is optional and you do not have to include it when typing unless you need it. So for the syntax above, you need to include 2 arguments for the MACTH worksheet function when typing it in a worksheet cell formula in order for it to calculate correctly. What argument values can be used are discussed below. Remember functions expect certain things in their argument lists, if you do not put the correct information in the list they will generate an error when run.
Since the MATCH function is a computer program, it runs when you press Enter to enter the formula that contains it. If any of the arguments are wrong, the function will return an error.
When typing the MATCH function in a worksheet cell formula, you need to replace the argument list with arguments separating each one with a comma (,). Some typical arguments you can use are:
|Cell Formula||Example Explanation|
|=MATCH("Widget1",A1:A5,0)||Find Widget1 in A1:A5 then returns position 1 through 5 depending on what cell contains it|
|=MATCH("*ST*",J9:J15,0)||Find the piece of text ST inside the cell value text in J9 to J15 then return position 1 through 7 depending on what cell contains it|
|=MATCH("*" & B1 & "*",G1:G5,0)||Find the piece of text from the B1 cell value inside the text in G1 to G5 then return position 1 through 5 depending on what cell contains it|
|=MATCH(16,A1:G1,0)||Find the number 16 in A1 to G1 then return position 1 through 7 depending on what cell contains it|
|=MATCH(B1,Prices,0)||Find the B1 cell value in range name Prices then return position*|
* It is possible to name a cell or group of cells on a worksheet and use that name in place of a range reference or cell reference. Consult Excel help on how to name a cell.
The worksheet seen below contains some typical worksheet formulas that run the MATCH worksheet function. Pay close attention to the argument list and the syntax used to write the formula.
|8||= VLOOKUP("X" , A3:B6, MATCH( "Q1", A3:Z3, 0 ) , FALSE )||MATCH is used to find the position of the table header Q1 in the range A3 to Z3 so the VLOOKUP function can automatically adjust where to retrieve its answer if more columns are added to the table. The value returned by MATCH is 2 so the value returned will be 100. The problem always assumes the table will start in column A so you can stretch the range reference past the table boundaries|
|17||= INDEX( A11:C14, MATCH( "Y", B11:B14, 0) , MATCH( "Quantity", A11:C11, 0 ) )||The MATCH and INDEX function combination is more powerful to use then VLOOKUP as this combination is capable of looking in any column or row of the table to lock on to and return values. The first MATCH locks on to the Y position relative to the table in the range B11 to B14 which is 3. The second MATCH function locks on to the Quantity header position relative to the table in range A11 to C11 which is 3. The INDEX function returns 200. MATCH will either be used in an absolute frame against the worksheet or in a relative frame against some area on a worksheet. It all depends on where you start the MATCH function from. Absolute style frames always start at Column A or Row 1 when designing the range reference that MATCH will use which means the first problem is using an absolute frame|