Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to use text value inside a formula

I want to grab the text contents of a cell and use that in a formula
in another cell.

So, say, for example, A1 contains TEST. Can I then put TEST in a
formula automatically in another cell formula, so that the formula
will essentially be:
=VLOOKUP(A5,[TEST.xls]Sheet1!$A4:$H203,2,FALSE)...

I have stock tickers in a cell and filenames named after each ticker
and want to do lookups into each ticker's file. The ticker symbols
change every day. Any advice appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default How to use text value inside a formula

Hi Gary,

I want to grab the text contents of a cell and use that in a formula
in another cell.

So, say, for example, A1 contains TEST. Can I then put TEST in a
formula automatically in another cell formula, so that the formula
will essentially be:
=VLOOKUP(A5,[TEST.xls]Sheet1!$A4:$H203,2,FALSE)...

I have stock tickers in a cell and filenames named after each ticker
and want to do lookups into each ticker's file. The ticker symbols
change every day. Any advice appreciated.


You want to take a look at the INDIRECT worksheet function, which does
what you want, with one annoying restriction: the files pointed to must
be open in Excel for this to work.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to use text value inside a formula

Thanks. I've read up on INDIRECT and wrote:

=("["&(INDIRECT("A5"&".xls]Sheet1!D1")))

It gives me a #REF! error. I believe I've written this correctly, but
obviously I haven't. Do I have a syntax problem? What am I not
understanding?

thanks for any help.

Gary

Jan Karel Pieterse wrote in message ...
Hi Gary,

I want to grab the text contents of a cell and use that in a formula
in another cell.

So, say, for example, A1 contains TEST. Can I then put TEST in a
formula automatically in another cell formula, so that the formula
will essentially be:
=VLOOKUP(A5,[TEST.xls]Sheet1!$A4:$H203,2,FALSE)...

I have stock tickers in a cell and filenames named after each ticker
and want to do lookups into each ticker's file. The ticker symbols
change every day. Any advice appreciated.


You want to take a look at the INDIRECT worksheet function, which does
what you want, with one annoying restriction: the files pointed to must
be open in Excel for this to work.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default How to use text value inside a formula

Hi Gary,

Thanks. I've read up on INDIRECT and wrote:

=("["&(INDIRECT("A5"&".xls]Sheet1!D1")))

It gives me a #REF! error. I believe I've written this correctly, but
obviously I haven't. Do I have a syntax problem? What am I not
understanding?


The safest method to create an external link using INDIRECT is:

First hardcode a direct reference.
Then construct a string formula so that the result is identical to that
reference.
Finally wrap that string expression with the INDIRECT function.

Yours is wrong, it should read something like:

=INDIRECT("'["& A5 & ".xls]Sheet1'!D1")

Note that sometimes apostrophs are needed, e.g. when the sheetname or
filename contains a space. I added them just to be sure.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

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
Reference text in a cell inside a formula to specify a sheet name navel151 Excel Worksheet Functions 5 February 20th 10 07:47 AM
How to embed large number of variables in text inside a text box? Riva Chase Excel Discussion (Misc queries) 0 October 30th 07 01:42 AM
using a formula inside a sting of text lauras03 Excel Discussion (Misc queries) 2 March 12th 07 05:03 PM
How to make the text inside Text Box upside down? Kataro Excel Discussion (Misc queries) 1 December 21st 05 03:38 PM
Need macro to insert text string while inside cell (formula) BrianB Excel Discussion (Misc queries) 0 May 31st 05 03:18 PM


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