Lookup with changing header columns

tropics123

Board Regular
Joined
May 11, 2016
Messages
85
Hi, any suggestions would be greatly appreciated. Below are two example files I receive from a vendor. The file is usually massive but for this purpose, I'm showing simple tables below.

The old formula I used was INDEX/MATCH to pull in Mary's phone to a different spreadsheet called MAIN. On the MAIN spreadsheet, there would be a designated cell and if I type in a person's name, then it would pull in different information into different cells, depending on what the formula is set-up to pull in. The "Phone" header used to move around to different columns. However, the new file we're receiving, the "Name" and "Phone" are moved again and in addition they added a bunch of columns in the front and most of the time they're blank, but we need to keep the columns there.

I tried using this VLOOKUP/MATCH formula (=VLOOKUP(lookup_value,range,MATCH(col_name,col_headers,0),0) but it doesn't work because the "Name" column needs to be the first column.

Does anyone have a solution if I want to lookup a person's name and their phone number (from the vendor sheet with columns are constantly shifting)? Please note that the person's name will change depending on what I type into cell B2 on my MAIN sheet.

Old File
NameAddressZipPhone
Mary123 Lake St12356###-###-####
Jane9876 Welder Ave23456###-###-####
Joe1234 Blaine Rd45678###-###-####

New File
IDOtherSomethingSomething ElseNameAddressAddress 2ZipPhone
Bob8977 Cake Town87765###-###-####
Mary123 Lake St12356###-###-####
John5678 Blueline Rd34456###-###-####
Larry4876 Lola Ln56789###-###-####
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
@tropics123 I think you are needing similar to this solution that I provided a couple of days back.
Here
Using Index Match to find your appropriate header and then the desired name / telephone number from the column.
You will likely need a formula for each of your files, old and new.
Hope that helps.
 
Upvote 0
How about
+Fluff.xlsm
ABCDEFGHIJKLMN
1IDOtherSomethingSomething ElseNameAddressAddress 2ZipPhoneNameZipAddress
2Bob8977 Cake Town87765###-###-####John344565678 Blueline Rd
3Mary123 Lake St12356###-###-####Bob877658977 Cake Town
4John5678 Blueline Rd34456###-###-####
5Larry4876 Lola Ln56789###-###-####
6
List
Cell Formulas
RangeFormula
M2:N3M2=INDEX($A:$I,MATCH($L2,INDEX($A:$I,,MATCH($L$1,$A$1:$I$1,0)),0),MATCH(M$1,$A$1:$I$1,0))
 
Upvote 0
How about
+Fluff.xlsm
ABCDEFGHIJKLMN
1IDOtherSomethingSomething ElseNameAddressAddress 2ZipPhoneNameZipAddress
2Bob8977 Cake Town87765###-###-####John344565678 Blueline Rd
3Mary123 Lake St12356###-###-####Bob877658977 Cake Town
4John5678 Blueline Rd34456###-###-####
5Larry4876 Lola Ln56789###-###-####
6
List
Cell Formulas
RangeFormula
M2:N3M2=INDEX($A:$I,MATCH($L2,INDEX($A:$I,,MATCH($L$1,$A$1:$I$1,0)),0),MATCH(M$1,$A$1:$I$1,0))
Hi @Fluff
This is perfect! Thank you so much! Just curious, I noticed in your formula there are two commas before the second MATCH. Why is that?

=INDEX($A:$I,MATCH($L2,INDEX($A:$I,,MATCH($L$1,$A$1:$I$1,0)),0),MATCH(M$1,$A$1:$I$1,0))
 
Upvote 0
That matches the column header & because no row values has been used it returns all the rows for the column.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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