Dynamic Named Range last 12 values

hp2108

New Member
Joined
Mar 24, 2010
Messages
6
Hi,

I am trying to find the last 12 values (1 year) in a dynamic range that spans columns G through to IV. I have used offset functions that return a range that should span the last 12 values.

However, it is selecting the last 11 values and the first empty cell. (I want it to include the last 12 values)....I have tested the cell to ensure that it is in fact empty.

The formula is below:

=OFFSET(OFFSET(PVR!$G$1,0,COUNT(PVR!$G$1:$IV$1),1,1),0,0,1,-12)

Does anyone have any ideas - I have been looking at this for way too long. I need a fresh set of eyes!

any help is greatly appreciated - Thank You!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I should add the range is contiguous and contains only numeric values.

The data currently ends at column AX but the named range selects AN:AY....

Thanks
 
Upvote 0
Hi

This should give you the last 12 occupied cells range.

Code:
=INDEX(Sheet1!$1:$1,0,MATCH(9.999E+307,Sheet1!$1:$1)-11):INDEX(Sheet1!$1:$1,0,MATCH(9.999E+307,Sheet1!$1:$1))
 
Upvote 0
Complementing my previous post

My formula works only if there is(are) no blank cell(s) in the middle of your data.

Sandeep's formula (i hadnt seen it) works even with blank cells, so its a safer (better) formula.

M.
 
Upvote 0
Thanks alot Sandeep - you have solved my problem with a completely different method to what i would have expected. Thanks!

Out of curiosity - do you know of any reasons as to why my original formula wouldn't have worked?

Thanks have a Great Day!
 
Upvote 0
Thanks Marcelo, yours is simpler! both work.

Given that the range is contiguous (and always will be) it doesn't really matter which one i use.

so not only have i solved my problem i have worked out a new way to approach the problem - Thanks Guys! (and thanks for tehe quick responses!)
 
Upvote 0
Out of curiosity - do you know of any reasons as to why my original formula wouldn't have worked?

Maybe it works with a small change
=OFFSET(OFFSET(PVR!$G$1,0,COUNT(PVR!$G$1:$IV$1)-1,1,1),0,0,1,-12)

M.
 
Upvote 0
Hi,

I am trying to find the last 12 values (1 year) in a dynamic range that spans columns G through to IV. I have used offset functions that return a range that should span the last 12 values.

However, it is selecting the last 11 values and the first empty cell. (I want it to include the last 12 values)....I have tested the cell to ensure that it is in fact empty.

The formula is below:

=OFFSET(OFFSET(PVR!$G$1,0,COUNT(PVR!$G$1:$IV$1),1,1),0,0,1,-12)

Does anyone have any ideas - I have been looking at this for way too long. I need a fresh set of eyes!

any help is greatly appreciated - Thank You!

Define Lrec as referring to:

=MATCH(9.99999999999999E+307,PVR!$G:$G)

Assuming that the data starts at G2...

Define ICount as referring to:

=COUNT(PVR!$G$2:INDEX(PVR!$G:$G,ROWS(PVR!$G:$G)))

Define LastN as referring to:

=12

Assumin that PVR!$G$1:$IV$1 is numeric, define HSize as referring to:

=COUNT(PVR!$G$1:INDEX(PVR!$1:$1,COLUMNS(PVR!$1:$1)))

Finally...

Define Data as referring to:

=OFFSET(INDEX(PVR!$G:$G,Lrec),0,0,-MIN(LastN,ICount),HSize)
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

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