google-sheetsindexingmatchvlookuparray-formulas

Pull data from one Sheet to another Sheet based on the Header names, headers in different order


I can't believe I can't figure this out but I keep getting errors.

Example sheets are found at: https://docs.google.com/spreadsheets/d/1q4qRgXSq6xXhddArPCoBIuOOupRvokUd0andADCNN0Q/edit?usp=sharing

'Sheet10' lets people choose the Header order in Sheet 11.

'Sheet11' uses the headers from 'Sheet10'. I need a formula for A2 that will populate the column with data from 'Sheet12' where the header has the same name. Note, the headers in 'Sheet12' are in a different order than in 'Sheet11'.

'Sheet12' is the existing data.

The ideal formula for 'Sheet11'!A2 would populate each column with the column of data in Sheet12 based on the column names.


Solution

  • You can use:

    =MAP(A1:E1,LAMBDA(h,FILTER(Sheet12!A2:E,Sheet12!A1:E1=h)))