Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • How to get first column number in range in Excel
  • Two-way lookup with VLOOKUP in Excel
  • Basic INDEX MATCH approximate in Excel
  • How to create dynamic named range with OFFSET in Excel
  • How to get last column number in range in Excel

Data Analysis Examples

  • How to calculate average last N values in a table in Excel
  • Add Outline to Data in Excel
  • Conditional Formatting New Rule with Formulas in Excel
  • How to create running total in an Excel Table
  • Create Scatter Chart in Excel

Data Validation Examples

  • Excel Data validation only dates between
  • Excel Data validation allow uppercase only
  • Excel Data validation specific characters only
  • Prevent invalid data entering in specific cells
  • Excel Data validation unique values only

Join tables with INDEX and MATCH in Excel

by

This tutorial shows how to Join tables with INDEX and MATCH in Excel using the example below;

Formula

=INDEX(data,MATCH(lookup,ids,0),2)

Explanation

To join or merge tables that have a common id, you can use the INDEX and MATCH functions. In the example shown, the formula in E5 is:

=INDEX(data,MATCH($C5,ids,0),2)

where “data” is the named range H5:J8 and “ids” is the named range H5:H8.

How this formula works

This formula pulls the customer name and state from the customer table into the order table. The MATCH function is used to locate the right customer and the INDEX function is used to retrieve the data.

Worked Example:   How to get last column number in range in Excel

Retrieving customer name

Working from the inside out, the MATCH function is used to get a row number like this:

MATCH($C5,ids,0)
  • The lookup value comes the customer id in C5, which is a mixed reference, with the column locked, so the formula can be easily copied.
  • The lookup array is the named range ids (H5:H8), the first column in the customer table.
  • The match type is set to zero to force an exact match.
Worked Example:   Partial match against numbers with wildcard in Excel

The MATCH function returns 2 in this case, which goes into INDEX as the row number:

=INDEX(data,2,2)

With the column number hard-coded as 2 (customer names are in column 2) and the array set to the named range “data” (H5:J8) INDEX returns: Amy Chang.

Retrieving customer state

The formula to retrieve customer state is almost identical. The only difference is the column number is hard-coded as 3, since state info appears in the 3rd column:

=INDEX(data,MATCH($C5,ids,0),2) // get name
=INDEX(data,MATCH($C5,ids,0),3) // get state

Dynamic two-way match

By adding another MATCH function to the formula, you can set up a dynamic two-way match. For example, with the named range “headers” for  H4:J4, you can use a formula like this:

=INDEX(data,MATCH($C5,ids,0),MATCH(E$4,headers,0))

Here, a second MATCH function has been added to get the correct column number. MATCH uses the current column header in the first table to locate the correct column number in the second table, and automatically returns this number to INDEX.

Worked Example:   Basic INDEX MATCH approximate in Excel

Post navigation

Previous Post:

INDEX and MATCH descending order in Excel

Next Post:

Index and match on multiple columns in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • SUBSTITUTE function: Description, Usage, Syntax, Examples and Explanation
  • How to check if cell contains number in Excel
  • DOLLAR function: Description, Usage, Syntax, Examples and Explanation
  • Normalize text by removing punctuations, extra spaces and more in Excel
  • How to convert text string to array in Excel
  • WEEKDAY function: Description, Usage, Syntax, Examples and Explanation
  • Get month from date in Excel
  • Convert decimal seconds to Excel time
  • Next biweekly payday from date in Excel
  • Convert date string to date time in Excel
  • How to calculate annual compound interest schedule in Excel
  • DOLLARDE function: Description, Usage, Syntax, Examples and Explanation
  • Calculate loan interest in given year in Excel
  • Calculate payment for a loan in Excel
  • RATE function: Description, Usage, Syntax, Examples and Explanation
© 2022 xlsoffice . All Right Reserved. | Teal Smiles