dynamic vlookup based on headers

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
707
Office Version
  1. 365
  2. 2010
so initiall i was using xlookup to get the last row of column BB, but now that specific column moved to column BH

the column header will always be "CAD EQUIV"

is there a way to have a dynamic lookup formula to get the last row of this column header?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Assuming your data is in cells BA2:BZ1000.
And your Headers are BA1:BZ1


=INDEX(BA2:BZ1000,999,MATCH("CAD EQUIV",BA1:BZ1,0))
 
Upvote 0
Maybe something like this:
Excel Formula:
=LET(getCol, XLOOKUP(TRUE,(Sheet1!$A$1:$BZ$1="CAD EQUIV"),Sheet1!$A$1:$BZ$1000), XLOOKUP(TRUE,getCol<>0,getCol,"",0,-1))
OR
Excel Formula:
=LET(getCol, INDEX(Sheet1!$A$1:$BZ$1000,0,MATCH("CAD EQUIV",Sheet1!$A$1:$BZ$1,0)), XLOOKUP(TRUE,getCol<>0,getCol,"",0,-1))
 
Last edited:
Upvote 0
Maybe this.

Excel Formula:
=TAKE(FILTER(Sheet1!A1:BZ1000,Sheet1!A1:BZ1="CAD EQUIV"),-1)
 
Upvote 0
Maybe this.

Excel Formula:
=TAKE(FILTER(Sheet1!A1:BZ1000,Sheet1!A1:BZ1="CAD EQUIV"),-1)
That will always return the last row in the range you specify ie in the range used by the formula 1:1000 it returns row 1000, so it is not dynamic.
 
Upvote 0
That will always return the last row in the range you specify ie in the range used by the formula 1:1000 it returns row 1000, so it is not dynamic.
You're right. Have to use XLOOKUP. I came up with something similar to yours.

Excel Formula:
=LET(f,FILTER(A1:BZ1000,(A1:BZ1="CAD EQUIV")),XLOOKUP(TRUE,f<>"",f,,0,-1))
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,306
Members
449,095
Latest member
Chestertim

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