# Thread: Solved: Why Doesn?t This INDIRECT Work?

1. ## Solved: Why Doesn?t This INDIRECT Work?

I have two defined names in workbook ?ABC?: CWM2 and BegNW06.
The formula defined by CWM2 is:
=Hist!\$Z\$1
The formula defined by BegNW06 is:
='C:\EXCEL Documents\XYZ.xls'!NetWorth06
where NetWorth06 is a defined name in workbook ?XYZ.xls? for the formula:
=Stks!\$N\$12

In workbook ?ABC.xls? if I write the formula:
=INDIRECT(?CWM?&?2?)
I will get the same numeric value that is produced if I write the formula:
=CWM2

However, if in workbook ?ABC.xls? I write the formula:
=INDIRECT(?BegNW?&?06?)
I get the error #REF!.

If I write the formula:
=INDIRECT("'C:\EXCEL Documents\XYZ.xls'!NetWorth"&"06")
I also get the error #REF!. If I write the formula:
= 'C:\EXCEL Documents\XYZ.xls'!NetWorth06
It returns the value of NetWorth06, as expected.

The question is why can I use the INDIRECT function to extract the value of CWM2, but I can?t use INDIRECT to extract the value of NetWorth06? Is this due to the definition of NetWorth06 containing a reference to a cell in another workbook?

2. Originally Posted by Cyberdude
If I write the formula:
=INDIRECT("'C:\EXCEL Documents\XYZ.xls'!NetWorth"&"06")
I also get the error #REF!. If I write the formula:
= 'C:\EXCEL Documents\XYZ.xls'!NetWorth06
It returns the value of NetWorth06, as expected.

The question is why can I use the INDIRECT function to extract the value of CWM2, but I can?t use INDIRECT to extract the value of NetWorth06? Is this due to the definition of NetWorth06 containing a reference to a cell in another workbook?

Hi Cyberdude,

I duplicated your problem but it works for me. The only time I get a #REF! error is when the workbook that you are referencing is close. When using the INDIRECT function that referencing another wokbook the file needs to be open for the formula to work.

3. Cyberdude isn't this post directly related to this one http://www.vbaexpress.com/forum/showthread.php?t=10536 you posted a couple of days earlier?

Regards,
Simon

4. Yes, Simon it is. However, this one seemed more generic so I decided to open a new thread. Perhaps that was a bad choice. Sorry.
Sid

5. Originally Posted by Shazam
When using the INDIRECT function that referencing another wokbook the file needs to be open for the formula to work.
Shazam, you hit the nail on the head. I knew that and just forgot it. That is, of course, the cause of the problem. Duh!
Fortunately, I figured out a workaround that permits me to create the names I want.

I appreciate the reminder. Thanks for your time.
Sid

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•