Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sailor4life
 
Posts: n/a
Default INDIRECT Function


Hello
My file is myfile2006.xls In cell B2 I have the current year 2006. In
B5 I am trying to reference last years file [MyFile2005.xls]sheet1!B4.
The formula that I am using
=indirect("[MyFile"& B2-1 &".xls]Sheet1!" & char(column()+64)&Row()-1)

is returning #ref

Both files are in the same directory. I understand that indirect will
not work with closed files. What am I doing wrong?
Thanks


--
Sailor4life
------------------------------------------------------------------------
Sailor4life's Profile: http://www.excelforum.com/member.php...o&userid=33723
View this thread: http://www.excelforum.com/showthread...hreadid=535045

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK
 
Posts: n/a
Default INDIRECT Function

Try putting brackets around B2-1 and Row()-1, i.e.:

=indirect("[MyFile"& (B2-1) &".xls]Sheet1!" &
char(column()+64)&(Row()-1))

and ensure that the file is open (as you are already aware)

Pete

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default INDIRECT Function

When I remember correctly, INDIRECT works with external sourece only, when
this is open at same time


Arvi Laanemets


"Sailor4life"
wrote in message
...

Hello
My file is myfile2006.xls In cell B2 I have the current year 2006. In
B5 I am trying to reference last years file [MyFile2005.xls]sheet1!B4.
The formula that I am using
=indirect("[MyFile"& B2-1 &".xls]Sheet1!" & char(column()+64)&Row()-1)

is returning #ref

Both files are in the same directory. I understand that indirect will
not work with closed files. What am I doing wrong?
Thanks


--
Sailor4life
------------------------------------------------------------------------
Sailor4life's Profile:

http://www.excelforum.com/member.php...o&userid=33723
View this thread: http://www.excelforum.com/showthread...hreadid=535045



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sailor4life
 
Posts: n/a
Default INDIRECT Function


Yes thats why I made the statement about the open file. Both file are
open at the time of the error. Even with this change suggested by Pete
I am still getting the error. It appears as though this formula
evalutes with " around the ref.


--
Sailor4life
------------------------------------------------------------------------
Sailor4life's Profile: http://www.excelforum.com/member.php...o&userid=33723
View this thread: http://www.excelforum.com/showthread...hreadid=535045

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff
 
Posts: n/a
Default INDIRECT Function

Hi!

Your formula works for me. (as long as both files are open)

Is the year number in B2 manually entered? Is it a date that's formatted to
display just the year?

Biff

"Sailor4life"
wrote in message
...

Yes thats why I made the statement about the open file. Both file are
open at the time of the error. Even with this change suggested by Pete
I am still getting the error. It appears as though this formula
evalutes with " around the ref.


--
Sailor4life
------------------------------------------------------------------------
Sailor4life's Profile:
http://www.excelforum.com/member.php...o&userid=33723
View this thread: http://www.excelforum.com/showthread...hreadid=535045





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kevin Vaughn
 
Posts: n/a
Default INDIRECT Function

Your formula worked for me, so a guess is, is it possible that the 2006 in
cell B2 is actually a date formatted to look like 2006 rather than the number
2006?
--
Kevin Vaughn


"Sailor4life" wrote:


Hello
My file is myfile2006.xls In cell B2 I have the current year 2006. In
B5 I am trying to reference last years file [MyFile2005.xls]sheet1!B4.
The formula that I am using
=indirect("[MyFile"& B2-1 &".xls]Sheet1!" & char(column()+64)&Row()-1)

is returning #ref

Both files are in the same directory. I understand that indirect will
not work with closed files. What am I doing wrong?
Thanks


--
Sailor4life
------------------------------------------------------------------------
Sailor4life's Profile: http://www.excelforum.com/member.php...o&userid=33723
View this thread: http://www.excelforum.com/showthread...hreadid=535045


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default INDIRECT Function

Sailor4life wrote...
My file is myfile2006.xls In cell B2 I have the current year 2006. In
B5 I am trying to reference last years file [MyFile2005.xls]sheet1!B4.
The formula that I am using
=indirect("[MyFile"& B2-1 &".xls]Sheet1!" & char(column()+64)&Row()-1)

is returning #ref

Both files are in the same directory. I understand that indirect will
not work with closed files. What am I doing wrong?


I suppose you've checked that [MyFile2005.xls]Sheet1!B4 itself doesn't
evaluate to #REF! .

Basic debugging applies. First, drop the INDIRECT but add visible
characters around the textref.

=""&("[MyFile"&B2-1&".xls]Sheet1!"&CHAR(COLUMN()+64)&ROW()-1)&"<"

Does this evaluate to "[MyFile2005.xls]Sheet1!B4" ? If so, is these
*really* your workbook and worksheet names? Even if they are, it never
hurts and often helps to enclose them inside single quotes, so

"'[MyFile"&B2-1&".xls]Sheet1'!"&CHAR(COLUMN()+64)&ROW()-1

as your textref. Next, check the literal external reference.

=[MyFile2005.xls]Sheet1!B4

If these turn out OK, then try R1C1 addressing. Since you seem to want
the value of B4 returned to cell B5, try

=INDIRECT("'[MyFile"&B2-1&".xls]Sheet1'!R[-1]C",0)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using INDIRECT in INDEX(LINEST.. ) function Incoherent Excel Worksheet Functions 4 January 10th 06 04:42 PM
include INDIRECT function into SUMPRODUCT formula markx Excel Worksheet Functions 1 November 9th 05 05:04 PM
INDIRECT Function - what am I doing wrong? MACRE0 Excel Discussion (Misc queries) 2 October 5th 05 08:47 PM
INDIRECT function question Joe Excel Worksheet Functions 1 February 14th 05 03:54 PM
Indirect( ) function loosing values when spreadsheets are closed Word4Dummies Excel Worksheet Functions 2 February 13th 05 12:41 PM


All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"