dynamic named ranges

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
707
Office Version
  1. 365
  2. 2010
right now I have a named range named "months" which is from ='Table 1'!$C$1:$AC$1. but, sometimes new months will be added, so right now the range has been extended to ='Table 1'!$C$1:$AK$1. Is there a way to make this dynamic?

Ditto for the named range "data," whihc is currently ='Table 1'!$C:$AC
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try:

months:
Excel Formula:
=OFFSET('Table 1'!$C$1,0,0,1,COUNTA('Table 1'!$C$1:$ZZ$1))

data:
Excel Formula:
=OFFSET('Table 1'!$C$1,0,0,1048576,COUNTA('Table 1'!$C$1:$ZZ$1))
 
Upvote 0
ok, i was able to do it like this

"=OFFSET('Table 1'!$C$1,0,0,COUNTA('Table 1'!$C:$C)+28,COUNTA('Table 1'!$1:$1))"

and named it "data_all," but doing so gives me a VALUE error with this formula

=XLOOKUP($A3,months,XLOOKUP(B$2,'Table 1'!$B:$B,data_all,0))/1000

not sure why, because when I click into the named range to see the range it's covering, it's capturing everything from C1 to the last row of AK

if i dont use the named range and simply use the columns, it's fine:

=XLOOKUP($A3,months,XLOOKUP(B$2,'Table 1'!$B:$B,'Table 1'!C:AK,0))/1000
 
Upvote 0
it's oK...i just made the formula like this:

=XLOOKUP($A3,'Table 1'!$C$1:$XFD$1,XLOOKUP(B$2,'Table 1'!$B:$B,'Table 1'!C:XFD,0))/1000

not the most elegant, but that's fine ...I'm guessing expanding the range to the maximum makes the spreadsheet slower even tho xlookup isn't a volatile formulka?
 
Upvote 0
XLOOKUP isn't volatile, but OFFSET is. You could try something like

months:
Excel Formula:
=Sheet6!$C$1:INDEX(Sheet6!$1:$1,COUNTA(Sheet6!$C$1:$ZZ$1)+3)

data:
Excel Formula:
=Sheet6!$C$1:INDEX(Sheet6!$A:$ZZ,1048576,COUNTA(Sheet6!$C$1:$ZZ$1)+3)


which uses INDEX instead to see if that makes it faster.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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