Excel Office

Excel How Tos, Tutorials, Tips & Tricks, Shortcuts

Category: Lookup and Reference Functions

Excel comes with multiple Lookup and Reference functions that let you find matching values. The Lookup and Reference functions help you to work with arrays of data, and are particularly useful when you need to cross reference between different data sets

MATCH function: Description, Usage, Syntax, Examples and Explanation

What is MATCH function in Excel? MATCH function is one of Lookup and Reference functions in Microsoft Excel that is used to search for an item in a range of cells, and then return the relative position of that item in the range. Syntax of MATCH function MATCH(lookup_value, lookup_array, [match_type]) MATCH formula explanation The MATCH function syntax has the following arguments: lookup_value:…

CHOOSE function: Description, Usage, Syntax, Examples and Explanation

What is Excel CHOOSE function? CHOOSE function is one of Lookup and Reference functions in Microsoft Excel that uses index_num to return a value from the list of value arguments. Use CHOOSE to select one of up to 254 values based on the index number. For example, if value1 through value7 are the days of the week, CHOOSE returns one of the days…

Create hyperlink with VLOOKUP in Excel

To create a hyperlink from a lookup, you can use the VLOOKUP function together with the HYPERLINK function. The hyperlink function allows you to create a working link with a formula. It takes two arguments: link_location and, optionally, friendly_name. Formula =HYPERLINK(VLOOKUP(name,table,column,0),name) Explanation In the example shown, the formula in F5 is: =HYPERLINK(VLOOKUP(E5,link_table,2,0),E5) How this formula works Working from the inside out, VLOOKUP looks…

How to calculate two-way lookup VLOOKUP in Excel Table

To do a two-way lookup in an Excel Table, you can use the MATCH function with a structured reference and VLOOKUP. See example below: Recall that VLOOKUP depends on the lookup value being to the left of the value being retrieved in a table. Generally, this means the lookup value will be the first value in the table. If you have data where…

To count total rows in a range in Excel

If you need to count the number of rows in a range, use the ROWS function. The ROWS counts the number of rows in the supplied range and returns that number as the result. See illustration below: Formula =ROWS(range) Explanation In the example, the active cell contains this formula: =ROWS(B4:C9)

Last row number in range

You can get the last row in a range with a formula based on the ROW function. See example below; Formula =MIN(ROW(range))+ROWS(range)-1 Explanation In the example shown, the formula in cell F5 is: =MIN(ROW(data))+ROWS(data)-1 where data is a named range for B5:D10 How this formula works When given a single cell reference, the ROW function returns the row number for…

How to get last row in text data in Excel

To get the last relative position (i.e. last row, last column) for text data (with or without empty cells), you can use the MATCH function. See example below: Formula =MATCH(bigtext,range) Explanation In the example shown, the formula in E5 is: =MATCH(REPT(“z”,255),B4:B11) How this formula works This formula uses the MATCH function in approximate match mode to locate the last text value in…

How to get last row in numeric data in Excel

To get the last relative position (i.e. last row, last column) for numeric data (with or without empty cells), you can use the MATCH function with a so called “big number”. see example below: Formula =MATCH(bignum,range) Explanation In the example shown, the formula in E5 is: =MATCH(9.99E+307,B4:B9) Last *relative* position, not row on worksheet When building advanced formulas that create…

How to get last row in mixed data with blanks in Excel

To get the last relative position (i.e. last row, last column) for mixed data that may contain empty cells, you can use the MATCH function as described below. Note: this is an array formula and must be entered with Control+Shift+Enter. Formula {=MATCH(2,1/(range<>””))} Explanation In the example shown, the formula in E5 is: {=MATCH(2,1/(B4:B10<>””))} Last *relative* position, not row on worksheet…

How to get last column number in range in Excel

You can get the last column in a range with a formula based on the COLUMN function. See example below: Formula =MIN(COLUMN(range))+COLUMNS(range)-1 Note: When given a single cell reference, the COLUMN function returns the column number for that reference. However, when given a range that contains multiple columns, the COLUMN function will return an array that contains all column numbers…

How to get relative row numbers in a range in Excel

To get a full set of relative row numbers in a range, you can use an array formula based on the ROW function. See example below; Formula {=ROW(range)-ROW(range.firstcell)+1} Note: this is an array formula that must be entered with Control + Shift + Enter. If you’re entering this on the worksheet (and not inside another formula), make a selection that includes more…

How to get relative column numbers in a range in Excel

This tutorial shows how to get a full set of relative column numbers in a range using an array formula based on the COLUMN function. Formula {=COLUMN(range)-COLUMN(range.firstcell)+1} On the worksheet, this must be entered as multi-cell array formula using Control + Shift + Enter This is a robust formula that will continue to generate relative numbers even when columns are inserted…

How to get address of last cell in range in Excel

To get the address of the first cell in a named range, you can use the ADDRESS function together with ROW and COLUMN functions. Formula =ADDRESS(ROW(range)+ROWS(range)-1,COLUMN(range)+COLUMNS(range)-1) Explanation In the example shown, the formula in G6 is: =ADDRESS(ROW(data)+ROWS(data)-1,COLUMN(data)+COLUMNS(data)-1) How this formula works The ADDRESS function builds an address based on a row and column number. Working from the inside out, we…

How to get address of named range in Excel

To get the full address of a named range with an Excel formula, you can use the ADDRESS function together with the ROW and COLUMN functions. Formula =ADDRESS(ROW(nr),COLUMN(nr))&”: “&ADDRESS(ROW(nr)+ROWS(nr)-1, COLUMN(nr)+COLUMNS(nr)-1) Explanation In the example shown, the formula in G5 is: =ADDRESS(ROW(data),COLUMN(data),4) &”:”&ADDRESS(ROW(data)+ROWS (data)-1,COLUMN(data)+COLUMNS(data)-1,4) where “data” is the named range B5:D10 How this formula works The core of this formula is the ADDRESS…

How to get first row number in range in Excel

You can get the first row (i.e. the starting row number) in a range with a formula based on the ROW function. Formula =MIN(ROW(range)) Explanation In the example shown, the formula in cell F5 is: =MIN(ROW(data)) where data is a named range for B5:D10 How this formula works When given a single cell reference, the ROW function returns the row…

How to get first column number in range in Excel

You can get the first column (i.e. the starting column number) in a range with a formula based on the COLUMN function. Formula =MIN(COLUMN(range)) Explanation In the example shown, the formula in cell F5 is: =MIN(COLUMN(data)) where data is a named range for B5:D10 How this formula works When given a single cell reference, the COLUMN function returns the column number for…

How to retrieve first match between two ranges in Excel

To retrieve the first match in two ranges of values, you can use a formula based on the INDEX, MATCH, and COUNTIF functions. Formula =INDEX(range2,MATCH(TRUE,COUNTIF(range1,range2)>0,0)) Explanation In the example shown, the formula in G5 is: =INDEX(range2,MATCH(TRUE,COUNTIF(range1,range2)>0,0)) where “range1” is the named range B5:B8, “range2” is the named range D5:D7. How this formula works In this example the named range “range1” refers to cells B5:B8,…

How to create dynamic named range with OFFSET in Excel

One way to create a dynamic named range with a formula is to use the OFFSET function together with the COUNTA function. Dynamic ranges are also known as expanding ranges – they automatically expand and contract  to accommodate new or deleted data. Note: OFFSET is a volatile function, which means it recalculates with every change to a worksheet. With a modern machine…

How to get address of first cell in range in Excel

To get the address of the first cell in a named range, you can use the ADDRESS function together with the ROW and COLUMN functions. See example below; Note: The ADDRESS function builds an address based on a row and column number. Formula =ADDRESS(ROW(range),COLUMN(range)) Explanation In the example shown, the formula in G5 is: =ADDRESS(ROW(data),COLUMN(data)) How this formula works Working…

How to reference named range different sheet in Excel

This tutorials shows how to reference a named range on another sheet. To achieve this, you can use the INDIRECT function with the required sheet syntax. Formula INDIRECT(“‘”&sheet&”‘!”&name) Explanation In the example shown, the formula in D6 is: =SUM(INDIRECT(“‘”&B6&”‘!”&C6)) Which returns the sum of the named range “data” on Sheet1. How this formula works The formula above evaluates something like…

Two-way lookup with VLOOKUP in Excel

This tutorial shows how to calculate Two-way lookup with VLOOKUP in Excel  using the example below; Formula =VLOOKUP(lookup_value,table,MATCH(col_name,col_headers,0),0) Explanation Note: Inside the VLOOKUP function, the column index argument is normally hard-coded as a static number. However, you can also create a dynamic column index by using the MATCH function to locate the right column. This technique allows you to create a dynamic two-way lookup,…

Multi-criteria lookup and transpose in Excel

This tutorial shows how to  work Multi-criteria lookup and transpose in Excel using the example below; Formula {=INDEX(range1,MATCH(1,($A1=range2)*(B$1=range3),0))} Explanation To perform a multi-criteria lookup and transpose results into a table, you can use an array formula based on INDEX and MATCH. In the example shown, the formula in G5 is: {=INDEX(amount,MATCH(1,($F5=location)*(G$4=date),0))} Note this formula is an array formula and must be entered with control +…

Merge tables with VLOOKUP in Excel

This tutorial shows how to  Merge tables with VLOOKUP in Excel using the example below; Formula =VLOOKUP($A1,table,COLUMN()-x,0) Explanation To merge tables, you can use the VLOOKUP function to lookup and retrieve data from one table to the other. To use VLOOKUP this way, both tables must share a common id or key. This article explains how join tables using VLOOKUP and a calculated column…

Lookup entire row in Excel

This tutorial shows how to Lookup entire row in Excel using the example below; Formula =INDEX(data,MATCH(value,array,0),0) Explanation To lookup and retrieve an entire row, you use the INDEX and MATCH functions. In the example shown, the formula used to look up all values for the Central region is: =INDEX(C5:F8,MATCH(H5,B5:B8,0),0) How this formula works The gist: use MATCH to identify the…

Find closest match in Excel

This tutorial shows how to Find closest match in Excel using the example below; Formula {=INDEX(data,MATCH(MIN(ABS(data-value)),ABS(data-value),0))} Explanation To find the closest match with a lookup value and numeric data, you can use an array formula based the INDEX, MATCH, ABS and MIN functions. In the example shown, the formula in E5 is: {=INDEX(data,MATCH(MIN(ABS(data-E4)),ABS(data-E4),0))} where “data” is the named range B5:B14, and E4…

Approximate match with multiple criteria in Excel

This tutorial shows how to calculate Approximate match with multiple criteria in Excel using the example below; Explanation To lookup and approximate match based on more than one criteria, you can use an array formula based on INDEX and MATCH, with help from the IF function. In the example shown, the formula in G8 is: {=INDEX(D5:D10,MATCH(G7,IF(B5:B10=G6,C5:C10),1))} Note: this is an…

Basic INDEX MATCH approximate in Excel

This tutorial shows how to calculate Basic INDEX MATCH approximate in Excel using the example below; Formula =INDEX(grades,MATCH(score,scores,1)) Explanation This example shows how to use INDEX and MATCH to retrieve a grade from a table based a given score. This requires an “approximate match”, since it is unlikely that the actual score exists in the table. The formula in cell F5 is:…

How to use Excel VLOOKUP Function

VLOOKUP function is actually quite easy to use once you understand how it works! This Excel tutorial explains how to use the VLOOKUP function with syntax and examples. Excel VLOOKUP Function Description VLOOKUP is an Excel function to lookup and retrieve data from a specific column in table. The VLOOKUP function performs a vertical lookup by searching for a value in the first…

How to use Excel ROWS Function

This Excel tutorial explains how to use the ROWS function with syntax and examples. Excel ROWS Function Description The Microsoft Excel ROWS function returns the number of rows in a cell reference. The ROWS function is a built-in function in Excel that is categorized as a Lookup/Reference Function. The ROWS function can be entered as part of a formula in a cell of…

How to use Excel TRANSPOSE Function

This Excel tutorial explains how to use the TRANSPOSE function with syntax and examples. Excel TRANSPOSE Function Description Microsoft Excel TRANSPOSE function returns a transposed range of cells. For example, a horizontal range of cells is returned if a vertical range is entered as a parameter. Or a vertical range of cells is returned if a horizontal range of cells is…

How to use Excel ROW Function

This Excel tutorial explains how to use the ROW function with syntax and examples. Excel ROW Function Description Microsoft Excel ROW function returns the row number of a cell reference. The ROW function is a built-in function in Excel that is categorized as a Lookup/Reference Function. The ROW function can be entered as part of a formula in a cell of a…

How to use Excel MATCH Function

This Excel tutorial explains how to use the MATCH function with syntax and examples. Excel MATCH function Description MATCH is an Excel function used to locate the position of a lookup value in a row, column, or table. MATCH supports approximate and exact matching, and wildcards (* ?) for partial matches. Often, the INDEX function is combined with MATCH to retrieve the value at the position…

How to use Excel MMULT Function

This Excel tutorial explains how to use the MMULT function with syntax and examples. Excel MMULT function Description Excel MMULT function returns the matrix product of two arrays. The array result contains the same number of rows as array1 and the same number of columns as array2. If returning multiple results in an array on the worksheet, enter as an array formula with control +…

How to use Excel LOOKUP Function

This Excel tutorial explains how to use the LOOKUP function with syntax and examples. Excel LOOKUP function Description The Microsoft Excel LOOKUP function returns a value from a range (one row or one column) or from an array. The LOOKUP function is a built-in function in Excel that is categorized as a Lookup/Reference Function. It can be used as a worksheet function (WS)…

How to use Excel INDIRECT Function

This Excel tutorial explains how to use the INDIRECT function with syntax and examples. Excel INDIRECT function Description Microsoft Excel INDIRECT function returns the reference to a cell based on its string representation. The INDIRECT function is a built-in function in Excel that is categorized as a Lookup/Reference Function that can be entered as part of a formula in a cell of a worksheet. Explanation: Based…

How to use Excel OFFSET function

This Excel tutorial explains how to use the OFFSET function with syntax and examples. Excel OFFSET function Description The Microsoft Excel OFFSET function returns a reference to a range that is offset a number of rows and columns from another range or cell. OFFSET function is a built-in function in Excel that is categorized as a Lookup/Reference Function. The OFFSET function can…

How to use Excel FORMULATEXT function

This Excel tutorial explains how to use the FORMULATEXT function with syntax and examples. Excel FORMULATEXT function Description FORMULATEXT function can be used in troubleshooting and auditing.  The Excel FormulaText function returns a formula as a text string. Explanation:  The Excel FORMULATEXT function returns a formula as a text string from given reference. You can use FORMULATEXT to extract a…