Forum Discussion

Xenophile's avatar
Xenophile
Copper Contributor
May 21, 2023

Match Two Columns from 2 Tabs to Return Info from 3rd

Hello! I am trying to figure out a way to match 2 columns (location and ID) from one sheet to 2 columns on a second sheet (location and ID) to return information from a 3rd column on the second sheet...
  • NikolinoDE's avatar
    May 21, 2023

    Xenophile 

    To match two columns (location and ID) from one sheet to two columns (location and ID) on a second sheet and retrieve information from a third column (statement type), you can use a combination of the INDEX and MATCH functions in Excel.

    Here's a step-by-step guide:

    Assuming:

    • Sheet1 contains the data you want to match (with location in column A, ID in column B, and other data in column C).
    • Sheet2 contains the master list of statement types (with location in column A, ID in column B, and statement type in column C).
    • You want to retrieve the statement type from Sheet2 and display it in Sheet1.
    1. In Sheet1, in the column where you want to display the statement type (let's say column D), enter the following formula in the first cell (e.g., D2):

    =INDEX(Sheet2!$C$2:$C$100, MATCH(A2&B2, Sheet2!$A$2:$A$100&Sheet2!$B$2:$B$100, 0))

    Make sure to adjust the range references (Sheet2!$C$2:$C$100, Sheet2!$A$2:$A$100, and Sheet2!$B$2:$B$100) to match the actual range containing the statement types and the corresponding location and ID on Sheet2.

    1. Press Enter to apply the formula to the first cell, and then copy the formula down to the rest of the cells in column D to populate the statement types for each corresponding location and ID.

    The formula uses the INDEX and MATCH functions together:

    • The MATCH function searches for a combination of location and ID (A2&B2) in the range of location and ID columns (Sheet2!$A$2:$A$100&Sheet2!$B$2:$B$100) on Sheet2. The third argument, 0, specifies an exact match.
    • The INDEX function retrieves the corresponding statement type (Sheet2!$C$2:$C$100) based on the position of the match.

    This approach allows you to match the two columns and retrieve the statement type even if the location may change for the same ID.

     

Resources