Hi Rich,
you can nest a match function inside a vlookup to work out the column number for you.
So a simple vlookup would look like this:
=VLOOKUP(A2,'Company Accidents'!A1:H6,2,0)
with a nested match function:
=VLOOKUP(A2,'Company Accidents'!A1:H6,MATCH(B$1,'Company Accidents'!$A$1:$H$1,0),0)
and finally to fix any errors if not found, add an iferror function:
=IFERROR(VLOOKUP(A2,'Company Accidents'!A1:H6,MATCH(B$1,'Company Accidents'!$A$1:$H$1,0),0),"")
Please see attached solution
|