Help with possible Index Match Match?

TheCrankyMule

New Member
Joined
Dec 20, 2018
Messages
2
Hi All,

This may be an impossible task so bear with me. I have the following raw data:
[TABLE="class: grid, width: 600"]
<tbody>[TR]
[TD]Owner[/TD]
[TD]Account ID[/TD]
[TD]Industry[/TD]
[TD]Industry#[/TD]
[TD]Account #[/TD]
[/TR]
[TR]
[TD]Joe[/TD]
[TD]1[/TD]
[TD]Plumber[/TD]
[TD]Primary Industry[/TD]
[TD]Primary Account[/TD]
[/TR]
[TR]
[TD]Joe[/TD]
[TD]2[/TD]
[TD]HVAC[/TD]
[TD]Secondary Industry[/TD]
[TD]Secondary Account[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]3[/TD]
[TD]Plumber[/TD]
[TD]Primary Industry[/TD]
[TD]Primary Account[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]4[/TD]
[TD]Electrician[/TD]
[TD]Secondary Industry[/TD]
[TD]Secondary Account[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]5[/TD]
[TD]Construction[/TD]
[TD]Tertiary Industry[/TD]
[TD]Tertiary Account[/TD]
[/TR]
</tbody>[/TABLE]

Then I need to append it to this table:
[TABLE="class: grid, width: 900"]
<tbody>[TR]
[TD]Owner[/TD]
[TD]Primary Industry[/TD]
[TD]Secondary Industry[/TD]
[TD]Tertiary Industry[/TD]
[TD]Primary Account[/TD]
[TD]Secondary Account[/TD]
[TD]Tertiary Account[/TD]
[/TR]
[TR]
[TD]Joe[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

So that it ends up looking like this:
[TABLE="class: grid, width: 900"]
<tbody>[TR]
[TD]Owner[/TD]
[TD]Primary Industry[/TD]
[TD]Secondary Industry[/TD]
[TD]Tertiary Industry[/TD]
[TD]Primary Account[/TD]
[TD]Secondary Account[/TD]
[TD]Tertiary Account[/TD]
[/TR]
[TR]
[TD]Joe[/TD]
[TD]Plumber[/TD]
[TD]HVAC[/TD]
[TD][/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]Plumber[/TD]
[TD]Electrician[/TD]
[TD]Construction[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]

I was thinking I could use an index match match, but I'm not able to make it work. Anyone have any solutions? Maybe I need to rearrange the data? It's tough, because I'm writing SQL to pull the raw data the way it is, so I'm a bit limited in how I pull it. Thanks so much for your help.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi. Try:

=IFERROR(IF(ISNUMBER(SEARCH("industry",B$9)),INDEX($C$2:$C$6,MATCH(1,INDEX(($D$2:$D$6=B$9)*($A$2:$A$6=$A10),0),0)),INDEX($B$2:$B$6,MATCH(1,INDEX(($E$2:$E$6=B$9)*($A$2:$A$6=$A10),0),0))),"")
 
Upvote 0
Hi & welcome to MrExcel
How about

Excel 2013/2016
ABCDEFGHIJKLM
1OwnerAccount IDIndustryIndustry#Account #OwnerPrimary IndustrySecondary IndustryTertiary IndustryPrimary AccountSecondary AccountTertiary Account
2Joe1PlumberPrimary IndustryPrimary AccountJoePlumberHVAC12
3Joe2HVACSecondary IndustrySecondary AccountBobPlumberElectricianConstruction345
4Bob3PlumberPrimary IndustryPrimary Account
5Bob4ElectricianSecondary IndustrySecondary Account
6Bob5ConstructionTertiary IndustryTertiary Account
Sheet6
Cell Formulas
RangeFormula
H2{=IFERROR(INDEX($C$2:$C$6,MATCH(1,($A$2:$A$6=$G2)*($D$2:$D$6=H$1),0)),"")}
K2{=IFERROR(INDEX($B$2:$B$6,MATCH(1,($A$2:$A$6=$G2)*($E$2:$E$6=K$1),0)),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.

fill both formulae across & down
 
Upvote 0
Wow. Thanks for this. I've used many array formulas when doing Index Match with multiple criteria, but I've never seen id quite this way before. Would you possibly be able to explain exactly how the Match() funtion is working in this formula? Otherwise I would appreciate it if you could point me to a resource that could help. Thanks again!
 
Upvote 0
If we consider the formula in H2
this ($A$2:$A$6=$G2) will return either true or false depending on if the values in A2:A6 equal G2 ie
TRUE;TRUE;FALSE;FALSE;FALSE
this ($D$2:$D$6=H$1) will do the same for col D & H1
TRUE;FALSE;TRUE,FALSE,FALSE
the * symbol coerces them to 1 where both are TRUE & 0 for the rest giving
1;0;0;0;0
The MATCH then matches the first 1 it finds (in the case the first value in the array)
so the formula then returns the 1st value in col C.

Something I find useful is to use "Evaluate Formula" on the formula tab.

HTH
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top