Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default putting a string from one cell in the formula of another -- indirect needed?

What I'd like to do is reference a cell when pointing to the path of a
file. For example, I have a sheet like this:

TOTALA TOTALB
=c:\path1!sheet1!A1 =c:\path1!sheet1!B1
=c:\path2!sheet2!A1 =c:\path2!sheet2!B1
=c:\path3!sheet3!A1 =c:\path3!sheet3!B1


What I'd like:

TOTALA TOTALB FILE
=[c1]!A1 =[c1]!B1 c:\path1!sheet1
=[c2]!A1 =[c2]!B1 c:\path3!sheet2
=[c3]!A1 =[c3]!B1 c:\path3!sheet3


In these 2 columns. Ok, so it's a lot more than 2 columns, but you get
the idea. What I'd like to do is make the reference in cell A1 above
be a concatenation of the path name in column c and the cell number in
the targetted file as in the pseudoformula above.

Some places seemed to indicate that using the indirect() function would
make this work, but I just can't seem to get the syntax right. Maybe
because the other files aren't open???

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete
 
Posts: n/a
Default putting a string from one cell in the formula of another -- indirect needed?

INDIRECT( ) can only get data from files which are open, although
others have referred to Harlan Grove's method of "pulling" data from a
closed file in recent postings - suggest you search for INDIRECT in the
archives. If your sheet names have spaces in them, you will have to
wrap apostrophes around the filename and sheetname as follows:

'c:\path1!sheet1'!A1

Hope this helps.

Pete

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default putting a string from one cell in the formula of another -- indirect needed?

Sort of. Being able to pull data from the closed file is useful, but
I'm really more interested in how to correctly build the formula in one
cell from strings in other cells.

Ideally I'd have something like this:

=c:\data\ & A3 & .xls!A1

evaluate to:

=c:\data\path\to\myfile.xls!A1

I can also write a macro that reads through the list of file names and
assigns the right formula to the right cells, but that's hard to
maintain. I'd prefer to know if the above is possible and how to do it
if it is.

Thanks,

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete
 
Posts: n/a
Default putting a string from one cell in the formula of another -- indirect needed?

You would need to put the literal text within quotes, as follows:

="c:\data\" & A3 & ".xls!A1"

and if A3 = "path\to\myfile" then this would evaluate to

"c:\data\path\to\myfile.xls!A1".

If this formula was in A4, for example, then the formula =INDIRECT(A4)
(maybe entered in A5) would attempt to retrieve the value in cell A1 of
the file pointed to - it would succeed if the file was open, otherwise
it returns an error.

Hope this helps.

Pete

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
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM
How do I set a cell value based on a formula in another cell? dingy101 Excel Discussion (Misc queries) 1 November 21st 05 08:51 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
referencing named formula using INDIRECT function [email protected] Excel Worksheet Functions 19 May 11th 05 09:48 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 06:14 PM.

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"