Skip to main content

INDEX and MATCH across multiple columns

Author: Amanda Li Last Modified: 2021-11-11

To lookup a value by matching across multiple columns, an array formula based on the INDEX and MATCH functions that incorporates MMULT, TRANSPOSE and COLUMN will do you a favor.

index match multiple columns 1

How to lookup a value by matching across multiple columns?

To fill in the corresponding class of each student as the above table shown, where the information is listed across multiple columns, you can first use the trick of the MMULT, TRANSPOSE and COLUMN function to produce a matrix array. Then the MATCH function will give you the position of your lookup value, which will be fed to INDEX to retrieve the value you are looking for in the array.

Generic syntax


√ Note: This is an array formula that requires you to enter with Ctrl + Shift + Enter.

  • return_range: The range where you want the formula to return the class information from. Here refers to the class range.
  • lookup_value: The value the formula used to find its corresponding class information. Here refers to the given name.
  • lookup_array: The range of cells where the lookup_value is listed; The range with the values to compare with the lookup_value. Here refers to the name range.
  • match_type 0: Forces MATCH to find the first value that exactly equals to the lookup_value.

To find the class of Jimmy, please copy or enter the formula below in the cell H5, and press Ctrl + Shift + Enter to get the result:


√ Note: The dollar signs ($) above indicate absolute references, which means the name and class ranges in the formula won't change when you move or copy the formula to other cells. Note that you should not add dollar signs to the cell reference that represents the lookup value, since you want it to be relative when you copy it to other cells. After you enter the formula, drag the fill handle down to apply the formula to the below cells.

index match multiple columns 2

Explanation of the formula


  • --($C$5:$E$7=G5): This segment checks each value in the range $C$5:$E$7 if they equal to the value in the cell G5, and generates a TRUE and FALSE array like this:
    The double negative will then convert the TRUEs and FALSEs to 1s and 0s to yield an array like this:
  • COLUMN($C$5:$E$7): The COLUMN function returns the column numbers for the range $C$5:$E$7 in an array like this: {3,4,5}.
  • TRANSPOSE(COLUMN($C$5:$E$7)^0) = TRANSPOSE({3,4,5}^0): After raising the power to 0, all the numbers in the array {3,4,5} will be converted to 1: {1,1,1}. The TRANSPOSE function then converts the column array to a row array like this: {1;1;1}.
  • MMULT(--($C$5:$E$7=G5),TRANSPOSE(COLUMN($C$5:$E$7)^0)) = MMULT({1,0,0;0,0,0;0,0,0},{1;1;1}): The MMULT function returns the matrix product of the two arrays like this: {1;0;0}.
  • MATCH(1,MMULT(--($C$5:$E$7=G5),TRANSPOSE(COLUMN($C$5:$E$7)^0)),0) = MATCH(1,{1;0;0},0): The match_type 0 forces the MATCH function to return the position of the first match of 1 in the array {1;0;0}, which is 1.
  • INDEX($B$5:$B$7,(MATCH(1,MMULT(--($C$5:$E$7=G5),TRANSPOSE(COLUMN($C$5:$E$7)^0)),0))) = INDEX($B$5:$B$7,1): The INDEX function returns the 1st value in the class range $B$5:$B$7, which is A.

To easily lookup a value by matching across multiple columns, you can also use our professional Excel add-in Kutools For Excel. See the instruction here to accomplish the mission.

Related functions

Excel INDEX function

The Excel INDEX function returns the displayed value based on a given position from a range or an array.

Excel MATCH function

The Excel MATCH function searches for a specific value in a range of cells, and returns the relative position of the value.

Excel MMULT function

The Excel MMULT function returns the matrix product of two arrays. The array result has the same number of rows as array1 and the same number of columns as array2.

Excel TRANSPOSE function

The Excel TRANSPOSE function rotates the orientation of a range or array. For example, it can rotate a table that arranged horizontally in rows to vertically in columns or vice versa.

Excel COLUMN function

The COLUMN function returns the number of column which formula appears or returns the column number of given reference. For example, formula =COLUMN(BD) returns 56.

Related Formulas

Multiple-criteria lookup with INDEX and MATCH

When dealing with a big database in an Excel spreadsheet with several columns and row captions, it’s always tricky to find something that meets multiple criteria. In this case, you can use an array formula with the INDEX and MATCH functions.

Two-way lookup with INDEX and MATCH

To search for something across both rows and columns in Excel, or we say to lookup a value at the intersection of the specific row and column, we can use the help of INDEX and MATCH functions.

Lookup closest match value with multiple criteria

In some cases, you may need to lookup the closest or approximate match value based on more than one criteria. With the combination of INDEX, MATCH and IF functions, you can quickly get it done in Excel.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...


Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations