Dynamic header match

MikeWall

New Member
Joined
Sep 26, 2016
Messages
16
Office Version
  1. 2016
Hi Guys,

I have been trying to come up with a formula for an issue

In sheet one , i have a result sheet where i want return data set from sheet 2.

The criteria for choosing the results are 2 fold, based on lookupkeys, then criteria which is country).

However the issue is, in sheet two, the columns could change, such as Column Y could be new jersey today and tomorrow it could be mexico.

What formula could i use that returns the coulmn based of the matched criteria now matter where it was?


criteria
LookupkeysItalyIrelandEuropeJersey
Sam
dave
mike
Dataset
MexicoIrelandWashingtonUnited statesEurope
Sam
dave
mike
 
In post #1, your rows are labelled Sam, dave & mike in identical order in each sheet. Therefore I assumed that is what you have. Can you confirm that?
If not, you need to give a clearer picture of what you do actually have.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Before I get involved in too much explanation: Is it actually doing what you want it to do?

Its not fully doing it., its bringing in the results from sheet 2, in the same order as sheet 2. but not in the order as lookup keys in sheet one.

It returns the right columns, however the look up keys could be in a different order.

I hope this makes sense
 
Upvote 0
Any chance then that you could make a small set of dummy data and expected results and post with XL2BB?
 
Upvote 0
we can use your dummy data as an example. We assume that the order of the look up keys are the same in sheet 1 & 2. but in this case they are seldom the case. I should have said this.
 
Upvote 0
Your formula assume the lookup key orders doesn't change. In the last 2 screen grab i change the order to mike same and dave and still. get the same results as mike same and dave

LookupkeysMexicoIrelandEuropeJersey
mikeadm
samben
davecfo
LookupkeysMexicoIrelandEuropeJersey
Samadm
daveben
mikecfo
MexicoIrelandWashingtonUnited states
Samadgj
davebehk
mikecfil
LookupkeysMexicoIrelandEuropeJersey
mikeadm
samben
davecfo
 
Upvote 0
Your formula assume the lookup key orders doesn't change.
Correct, that is what I stated in post #11 because that is what you posted originally.;)
In post #1, your rows are labelled Sam, dave & mike in identical order in each sheet. Therefore I assumed that is what you have.


Try this instead

MikeWall 2020-04-02 1.xlsm
ABCDE
1LookupkeysItalyIrelandEuropeJersey
2dave en 
3mike fo 
4Sam dm 
Sheet1
Cell Formulas
RangeFormula
B2:E4B2=IFERROR(INDEX(Sheet2!$B$2:$F$4,MATCH($A2,Sheet2!$A$2:$A$4,0),MATCH(B$1,Sheet2!$B$1:$F$1,0)),"")
 
Upvote 0

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

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