INDIRECT and Dynamic Named Ranges problem

rossa

Board Regular
Joined
Nov 7, 2013
Messages
109
I was brushing up on Dynamic named ranges and ran into an issue using INDIRECT. I started off creating three Columns named Jan, Feb and Mar in columns C through E, on row 2. Rows 3 through 6 contained numbers. I named each range based on the heading, in cells J2:J4 I enetred the range names to use in an INDEX formula.
I then used the following formula to do a sum for each range (A1 contained 1, 2 or 3 which represented Jan, Feb and Mar).
SUM(INDIRECT(INDEX(J2:J4,A1)))

So far so good, everything worked fine until I tried to make the range "Jan" dynamic.
I used the formula belwo in the name manager for Jan, for some reason whenever I select 1 in A1 the formula now gives me a #REF! error
OFFSET(Sheet4!$C$2,1,0,COUNTA(Sheet4!$C:$C)-1,1)
Does anyone know why changing (or attempting to) the range to dynamic causes this?

Also regarding the use of INDIRECT, I read it can slow things down, is CHOOSE a better function?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try this:

Code:
=SUM(CHOOSE(A1,Jan,Feb,Mar))

Note: you can use EVALUATE function too. You can create a name:

Month - Refers To: =EVALUATE(INDEX(Sheet1!$J$4:$J$6,Sheet1!$A$1))

And use the formula =SUM(Month)

Markmzz
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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