Excel - Searching Multiple Columns

%3CLINGO-SUB%20id%3D%22lingo-sub-2268340%22%20slang%3D%22en-US%22%3EExcel%20-%20Searching%20Multiple%20Columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2268340%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20write%20an%20equation%20that%20will%20pull%20the%20officer%20name%20using%20the%20corresponding%20code%20to%20match.%20Below%20are%20a%20mock%20up%20of%20the%20data%20that%20I%20am%20using.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMcNamara_0-1618248131799.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F272065i6485483B3E15946A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JMcNamara_0-1618248131799.png%22%20alt%3D%22JMcNamara_0-1618248131799.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JMcNamara_2-1618248214495.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F272070iA3F6A68EFBB4BDCB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JMcNamara_2-1618248214495.png%22%20alt%3D%22JMcNamara_2-1618248214495.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20what%20I%20need%20is%20a%20formula%20that%20will%20look%20at%20the%20%22Code%22%20column%20and%20search%20the%20%22code%20type%22%20spreadsheet%2C%20grab%20the%20applicable%20officer%20and%20put%20their%20name%20in%20the%20%22officer%22%20column%20on%20the%20second%20spreadsheet%20automatically.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20issue%20that%20I%20am%20having%20is%20I%20cant%20find%20a%20way%20for%20the%20equation%20to%20search%20for%20a%20match%20in%20all%20three%20%22code%20types%22%20columns%20and%20then%20pull%20the%20appropriate%20officer%20name.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2268340%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

I am trying to write an equation that will pull the officer name using the corresponding code to match. Below are a mock up of the data that I am using.

 

JMcNamara_0-1618248131799.png 

 

JMcNamara_2-1618248214495.png

 

So what I need is a formula that will look at the "Code" column and search the "code type" spreadsheet, grab the applicable officer and put their name in the "officer" column on the second spreadsheet automatically.

 

The issue that I am having is I cant find a way for the equation to search for a match in all three "code types" columns and then pull the appropriate officer name.

 

 

2 Replies

@JMcNamara 

In D2:

=INDEX('Code Types'!$A$2:$A$4,SUMPRODUCT(('Code Types'!$B$2:$D$4=C2)*(ROW('Code Types'!$B$2:$D$4)-ROW('Code Types'!$B$2)+1)))

where Code Types is the name of the sheet with Code Type 1, Code Type 2 etc.

Adjust the ranges if needed, then fill down.

Worked great! Thanks! I truly appreciate your help.