Solved

# Using INDIRECT with Dynamic Range Names

Posted on 2014-09-05
259 Views
All,

I have the following formula in a spreadsheet for tracking my time bookings:

This works fine and when copied down across 15 rows provides me with a list of charge codes extracted from a bigger list. I have the bigger list split into two sections so that I can change my bookings for alternate weeks. The list is split into two Named Ranges - "Week1" and "Week2". As you can see the formula uses an INDEX formula on the Named Ranges, Week1 or Week2 based on the VLOOKUP which checks the current date in another list where I have week ending dates allocated to a 1 or a 2.

The problem comes when from time to time I have to add/delete booking codes to the big list; I then have to manually change the Named Ranges so that they still accommodate half of the list each, assuming even number of codes so that it can split evenly.

What I have tried doing but have been unsuccessful is using a Dynamic Named Range for Week1 and Week2. I have tried in a couple of ways:

1) Using an OFFSET formula within the "Refers to" to generate the range
2) Create the Range Name within a cell using ADDRESS and extra characters to make the full range; then use INDIRECT in the Name Manager to reference that cell.

Neither of these work.

What else can I try?

Thanks
Rob Henson
0
Question by:Rob Henson
• 6
• 3

LVL 48

Expert Comment

Could you send a dummy?
0

LVL 31

Author Comment

See attached with relevant areas highlighted on Charge Lines tab.

Formula in column B also has another issue. I am attempting to spread my time evenly over a number of Charge lines. As you will see with this example, the last entry gets a bigger proportion. I suspect it is because I am dividing the time by a count of items in the range but the blanks at the bottom are getting included in the count; until you reach the last entry where it is taking the outstanding balance. I have tried changing to use COUNTIF(Range,"<>"&"") but that is still not working.

Any suggestions?

Thanks
Rob H
Dummy-Time-bookings.xlsm
0

LVL 31

Author Comment

Sorted the last issue:

(COUNTA(\$B\$23:\$B\$42)-COUNTIF(\$B\$23:\$B\$42,"")+1)

So just the original INDIRECT issue now to resolve.

Thanks
0

LVL 48

Accepted Solution

Rgonzo1971 earned 500 total points
Hi,

if Week1Range and Week2Rang as required you could try in your formula

INDIRECT(INDIRECT(Week1Range))
0

LVL 31

Author Comment

Currently in Week2 so tried this:

=IF(ISERROR(INDEX(INDIRECT(INDIRECT(Week2Range)),ROW()-ROW(\$B\$22),1)),"",IF(INDEX(INDIRECT(INDIRECT(Week2Range)),ROW()-ROW(\$B\$22),1)=0,"",INDEX(INDIRECT(INDIRECT(Week2Range)),ROW()-ROW(\$B\$22),1)))

I get blank so I guess it is causing an error so tripping the ISERROR

However, with

INDEX(INDIRECT(Week2Range)...

I get the right result. I guess that was a typo with the INDIRECT twice.

Thanks
Rob H
0

LVL 31

Author Comment

Sorry, the double INDIRECT was correct, the following now working:

As an aside, any suggestions for making shorter?

Thanks
Rob H
0

LVL 31

Author Closing Comment

0

LVL 48

Expert Comment

Im not sure why you have to test for Index = 0

if Not

Regards
0

LVL 31

Author Comment

Thanks again, first suggestion works great.

I am testing for INDEX = 0 for the occasions when there is an odd number of Charge Lines so weeks 1 & 2 will have differing numbers.

Converting to blank is then allowed for in the spread of time calculations.

Thanks
Rob H
0

## Featured Post

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.