Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Referencing Workbook Name in Formula

I need to set up a formula that will allow me to specify a specific
workbook and worksheet name as part of a relative reference.

I can refer to a cell on a specific sheet within a specific workbook
using:

=[Book.xls]Sheet1!A1

I can accomplish the same thing using:

=INDIRECT(CONCATENATE("'[",$X$1,"]",$X$2,"'!",”A1”))

Whe
Cell X1 – Book1.xls
Cell X2 – Sheet1

If I copy/paste the first expression ‘A1’ will behave as a relative
reference however the second expression is effectively:

=[Book.xls]Sheet1!$A$1

Is there any way I can define the formula with the workbook and
worksheet names defined in the specified cells, X1 and X2 in the
example, and still have the ‘A1’ portion behave as a relative
reference?

Thanks,
Russ D.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 213
Default Referencing Workbook Name in Formula

I need to set up a formula that will allow me to specify a specific
workbook and worksheet name as part of a relative reference.

I can refer to a cell on a specific sheet within a specific workbook
using:

=[Book.xls]Sheet1!A1

I can accomplish the same thing using:

=INDIRECT(CONCATENATE("'[",$X$1,"]",$X$2,"'!",”A1”))

Whe
Cell X1 – Book1.xls
Cell X2 – Sheet1

If I copy/paste the first expression ‘A1’ will behave as a relative
reference however the second expression is effectively:

=[Book.xls]Sheet1!$A$1

Is there any way I can define the formula with the workbook and
worksheet names defined in the specified cells, X1 and X2 in the
example, and still have the ‘A1’ portion behave as a relative
reference?


Instead of "A1", you might try using the functions ROW() and COLUMN(),
adding or subtracting an offset as needed, in constructing the required
cell reference.

Notice that setting the second argument of INDIRECT to FALSE invokes R1C1
style references, avoiding the need to do arithmetic on alphabetic
character codes for the first part of the cell reference.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Referencing Workbook Name in Formula

You don't need to use CONCATENATE to put text together. Try this (off the
top of my head) formula....

=INDIRECT("["&$X$1&"]"&$X$2&"!"&A1)

Rick


************************************
"Russ" wrote in message
...
I need to set up a formula that will allow me to specify a specific
workbook and worksheet name as part of a relative reference.

I can refer to a cell on a specific sheet within a specific workbook
using:

=[Book.xls]Sheet1!A1

I can accomplish the same thing using:

=INDIRECT(CONCATENATE("'[",$X$1,"]",$X$2,"'!",”A1”))

Whe
Cell X1 – Book1.xls
Cell X2 – Sheet1

If I copy/paste the first expression ‘A1’ will behave as a relative
reference however the second expression is effectively:

=[Book.xls]Sheet1!$A$1

Is there any way I can define the formula with the workbook and
worksheet names defined in the specified cells, X1 and X2 in the
example, and still have the ‘A1’ portion behave as a relative
reference?

Thanks,
Russ D.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Referencing Workbook Name in Formula

If you are copying down, so you want the row number to change, then
you can do it like this:

=INDIRECT("'[" & $X$1 & "]" & $X$2 & "'!A" & ROW(A1))

The ROW(A1) term (returning 1) becomes ROW(A2), ROW(A3), ROW(A4) etc
as it is copied down, thus returning 2, 3, 4 etc.

Hope this helps.

Pete

On May 13, 8:13*pm, Russ wrote:
I need to set up a formula that will allow me to specify a specific
workbook and worksheet name as part of a relative reference.

I can refer to a cell on a specific sheet within a specific workbook
using:

=[Book.xls]Sheet1!A1

I can accomplish the same thing using:

=INDIRECT(CONCATENATE("'[",$X$1,"]",$X$2,"'!",”A1”))

Whe
Cell X1 – Book1.xls
Cell X2 – Sheet1

If I copy/paste the first expression ‘A1’ will behave as a relative
reference however the second expression is effectively:

=[Book.xls]Sheet1!$A$1

Is there any way I can define the formula with the workbook and
worksheet names defined in the specified cells, X1 and X2 in the
example, and still have the ‘A1’ portion behave as a relative
reference?

Thanks,
Russ D.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Referencing Workbook Name in Formula

On May 13, 4:31 pm, Pete_UK wrote:
If you are copying down, so you want the row number to change, then
you can do it like this:

=INDIRECT("'[" & $X$1 & "]" & $X$2 & "'!A" & ROW(A1))

The ROW(A1) term (returning 1) becomes ROW(A2), ROW(A3), ROW(A4) etc
as it is copied down, thus returning 2, 3, 4 etc.

Hope this helps.

Pete

On May 13, 8:13 pm, Russ wrote:

I need to set up a formula that will allow me to specify a specific
workbook and worksheet name as part of a relative reference.


I can refer to a cell on a specific sheet within a specific workbook
using:


=[Book.xls]Sheet1!A1


I can accomplish the same thing using:


=INDIRECT(CONCATENATE("'[",$X$1,"]",$X$2,"'!",”A1”))


Whe
Cell X1 – Book1.xls
Cell X2 – Sheet1


If I copy/paste the first expression ‘A1’ will behave as a relative
reference however the second expression is effectively:


=[Book.xls]Sheet1!$A$1


Is there any way I can define the formula with the workbook and
worksheet names defined in the specified cells, X1 and X2 in the
example, and still have the ‘A1’ portion behave as a relative
reference?


Thanks,
Russ D.


Thanks for the help. The formula now creates a relative reference to
the correct sheet and updates whenever I change the specified workbook
name in cell X1.

The only problem now is that the specified workbook needs to be open
to extract the data. I 'm trying to build a single summary sheet that
can extract data from several workbooks without the need to open each
individual workbook whenever I change the filename in cell X1.

I tried adding the full directory path:

C:\data\Sheet1.xls

But the cell values still become #REF whenever I close the source
workbook.

Any ideas?

Thanks,
Russ D.

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
Referencing other workbook. [email protected] Excel Worksheet Functions 1 September 4th 06 05:59 PM
VLOOKUP referencing another workbook kleivakat Excel Discussion (Misc queries) 2 March 9th 06 05:35 PM
Referencing a different Workbook Ken Excel Worksheet Functions 8 November 24th 05 01:20 AM
Referencing another Workbook Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 0 April 6th 05 07:16 PM
formula referencing another workbook Steve D Excel Worksheet Functions 2 January 7th 05 09:43 PM


All times are GMT +1. The time now is 01:38 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"