Get last column with data within an HLOOKUP

espenskeie

Well-known Member
Joined
Mar 30, 2009
Messages
636
Office Version
  1. 2016
Platform
  1. Windows
Hi

I have this code that I want to only look within a dynamic range.

=HLOOKUP(I5;Comments!D3:G11;3)

D3:G11 should be D3:"Last column With data in row 3"

I5 is a cell where the user can Select week number, i Guess this function doesn't make any problems to the formula...

Any suggestions to how I solve this?

Br
Espen
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi,

Replace your FORMULA with this: =HLOOKUP(I5;OFFSET(COMMENTS!D3;0;0;4;MAX(COLUMN(D:AA)*(D3:AA3<>""))-3);3;0)
and confirm with Ctrl+Shift+enter as it's an array formula.
If your data goes beyond column AA change that accordingly in the MAX function.
 
Upvote 0
Thanks

I now have another Challenge. As the data grows, I want to create an array of last four columns only, like a rolling period.

So if I have data from D3 to O11, I would the area to be L3:O11, do you know how I can modify to get this to work?

Br
Espen
 
Upvote 0
Hi,

You probably know different questions needs to be in different threads but ....
=OFFSET(D3;0;MAX(COLUMN(D:AA)*(D3:AA3<>""))-4;9;-4)

Again confirmed with Ctrl+Shift+Enter

This creates a range from L3:O11
 
Last edited:
Upvote 0
Thanks a lot. Yes i was walking in the shade of the forum rules...

I did bump into a New problem, and will take that to a New post ;)

Thanks
Espen
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,849
Members
449,471
Latest member
lachbee

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