How to make vlookup criteria use column header

chimneytop

New Member
Joined
Aug 13, 2015
Messages
7
I have two sheets. Sheet1 has a table of data that I will need to lookup, and I will be pasting data from another workbook into Sheet2 that has somewhat consistent column headers but in different orders. I want to put a formula in Sheet2!A:A that finds a specific column in the pasted data and then uses it lookup a value in Sheet1. I've made three examples of Sheet2 below

ABCD
1CheckWeightColorMaterial
2=vlookup(OR("Material","Materials","Mat.","Mats")2,Sheet1!A3:C52,3,false)5BlueWood
3=vlookup(OR("Material","Materials","Mat.","Mats")3,Sheet1!A3:C52,3,false)6RedRubber

<tbody>
</tbody>

Goal for A2 is to return same result as =vlookup(D2,Sheet1!A3:C52,3,false)

-----

ABCD
1CheckWeightColorMats
2=vlookup(OR("Material","Materials","Mat.","Mats")2,Sheet1!A3:C52,3,false)5BlueWood
3=vlookup(OR("Material","Materials","Mat.","Mats")3,Sheet1!A3:C52,3,false)6RedRubber

<tbody>
</tbody>



Goal for A2 is to return same result as =vlookup(D2,Sheet1!A3:C52,3,false)

-----

ABCD
1CheckColorMat.Weight
2=vlookup(OR("Material","Materials","Mat.","Mats")2,Sheet1!A3:C52,3,false)BlueWood5
3=vlookup(OR("Material","Materials","Mat.","Mats")3,Sheet1!A3:C52,3,false)RedRubber6

<tbody>
</tbody>


Goal for A2 is to return same result as =vlookup(C2,Sheet1!A3:C52,3,false)
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Code:
=VLOOKUP(INDIRECT(SUBSTITUTE(ADDRESS(1,MATCH("Mat*",$1:$1,0),4),"1","")&ROW(A2)),Sheet1!$A$3:$C$52,3,FALSE)
This will work as long as the column label starts with Mat. Also it will take only the first instance of Mat, meaning that if you have Mat. in column C and Materials in column D it will use column C in the vlookup. Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,922
Members
449,056
Latest member
denissimo

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