INDEX MATCH when column locations change

Stuepef

Board Regular
Joined
Oct 23, 2017
Messages
128
Office Version
  1. 2021
Platform
  1. Windows
I have a spreadsheet that has a lot of company information on it and I need to obtain specific pieces of information from it. INDEX MATCH works out great if the match column remains in the same location on the spreadsheet, but many times, it is located in a different location each time. The total range of the data does not go passed column DA, but I am trying to avoid a formula that includes entire columns (ie. E:E) or entire rows to save file size.

For an outcome, I would like to make a list of employee names based on the relationship column = "Employee" and what plan they are on currently in the Plan Display Column. The two columns of Relationship and Plan Display Name can be located anywhere in the spreadsheet from Columns A through DA.

Below is a sample of the information and the outcome.

Here is my shot at the formlua IF the information stayed in the same column location:

Excel Formula:
{=INDEX($A$2:$A$13,SMALL(IF(($B$2:$B$13="Employee"),ROW($U$2:$U$13)-1),ROW(1:1)),1)}
Excel Formula:
{=INDEX($C$2:$C$13,SMALL(IF(($B$2:$B$13="Employee"),ROW($U$2:$U$13)-1),ROW(1:1)),1)|

1696444010541.png
 
How about
Excel Formula:
=LET(nam,INDEX(A2:DA100,,XMATCH("Name",A1:DA1)),rel,INDEX(A2:DA100,,XMATCH("relationship",A1:DA1)),plan,INDEX(A2:DA100,,XMATCH("plan",A1:DA1)),FILTER(CHOOSE({1,2},nam,plan),rel="employee"))
 
Upvote 1

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
multiple posts solutions-v3.xlsm
ABCDEF
1namerelationshipplannameplan
2bobby jonesemployeeplan abcbobby jonesplan abc
3frida jonesspouseplan abcstue andersonplan def
4george joneschildplan abcbridgette crawfordplan def
5stue andersonemployeeplan defjason mcclayplan ghi
6bridgette crawfordemployeeplan defrobert mcilroyplan ghi
7elliot crawfordspouseplan defernest schmidtplan ghi
8jason mcclayemployeeplan ghi
9robert mcilroyemployeeplan ghi
10ernest schmidtemployeeplan ghi
11nicole schmidtspouseplan ghi
12robert schmidtchildplan ghi
13lenard schmidtchildplan ghi
INDEX MATCH when column locatio
Cell Formulas
RangeFormula
E2:E7E2=FILTER(INDIRECT(ADDRESS(2,MATCH(E1,A1:DA1,0))&":"&ADDRESS(13,MATCH(E1,A1:DA1,0))),INDIRECT(ADDRESS(2,MATCH("relationship",A1:DA1,0))&":"&ADDRESS(13,MATCH("relationship",A1:DA1,0)))="employee")
F2:F7F2=FILTER(INDIRECT(ADDRESS(2,MATCH(F1,A1:DA1,0))&":"&ADDRESS(13,MATCH(F1,A1:DA1,0))),INDIRECT(ADDRESS(2,MATCH("relationship",A1:DA1,0))&":"&ADDRESS(13,MATCH("relationship",A1:DA1,0)))="employee")
Dynamic array formulas.
 
Upvote 0
How about
Excel Formula:
=LET(nam,INDEX(A2:DA100,,XMATCH("Name",A1:DA1)),rel,INDEX(A2:DA100,,XMATCH("relationship",A1:DA1)),plan,INDEX(A2:DA100,,XMATCH("plan",A1:DA1)),FILTER(CHOOSE({1,2},nam,plan),rel="employee"))
This is pretty slick - my concern is for end users that don't have 365. Do you have a formula suggestion that operates similar for older verisons of excel?
 
Upvote 0
Maybe something like this to start, so long as those column headers are unique within the range A:DA.

Book1
ABCDEFGHI
1NameRelationshipPlan
2Bobby JonesEmployeePlan ABC
3Frida JonesSpousePlan ABC
4George JonesChildPlan ABC
5Stue AndersonEmployeePlan DEF
6Bridgette CrawfordEmployeePlan DEF
7Elliot CrawfordSpousePlan DEF
8Jason McClayEmployeePlan GHI
9Robert McIlroyEmployeePlan GHI
10Ernest SchmidtEmployeePlan GHI
11Nicole SchmidtSpousePlan GHI
12Robert SchmidtChildPlan GHI
13Lenard SchmidtChildPlan GHI
14
15Outcome
16NamePlan
17Bobby JonesPlan ABC
18Stue AndersonPlan DEF
19Bridgette CrawfordPlan DEF
20Jason McClayPlan GHI
21Robert McIlroyPlan GHI
22Ernest SchmidtPlan GHI
23
Sheet3
Cell Formulas
RangeFormula
B17:B22B17=INDEX(CHOOSECOLS($A$1:$DA$13,MATCH("Plan",$A$1:$DA$1,0)),MATCH(A17&"Employee",CHOOSECOLS($A$1:$DA$13,MATCH("Name",$A$1:$DA$1,0))&CHOOSECOLS($A$1:$DA$13,MATCH("Relationship",$A$1:$DA$1,0)),0))
This is interesting - is there a way to make a formula for the names using the CHOOSECOLS logic?
 
Upvote 0
This is interesting - is there a way to make a formula for the names using the CHOOSECOLS logic?
What do you mean? My formula assumes your output is static and the input columns vary within the range A:DA. Is your output table moving too?
 
Upvote 0
What do you mean? My formula assumes your output is static and the input columns vary within the range A:DA. Is your output table moving too?
Your formula uses A17 to reference a name. My question is is there a formula to populate the names column in range A17:A22? The INDEX would be Name and the match would be "employee" within the relationship column.
 
Upvote 0
Your formula uses A17 to reference a name. My question is is there a formula to populate the names column in range A17:A22? The INDEX would be Name and the match would be "employee" within the relationship column.
Yeah, give this a try (I'm using 2013 at home so I can't test this):

Excel Formula:
=FILTER(CHOOSECOLS($A$1:$DA$13,MATCH("Name",$A$1:$DA$1,0)),CHOOSECOLS($A$1:$DA$13,MATCH("Relationship",$A$1:$DA$1,0))="Employee")
 
Upvote 1
Yeah, give this a try (I'm using 2013 at home so I can't test this):

Excel Formula:
=FILTER(CHOOSECOLS($A$1:$DA$13,MATCH("Name",$A$1:$DA$1,0)),CHOOSECOLS($A$1:$DA$13,MATCH("Relationship",$A$1:$DA$1,0))="Employee")
Here is the result:
SPILL.png
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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