LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Variable reference in a function

Some sheet names need to be surrounded with single quotes.

=indirect("'" & a1 & "'!c1")

If the single quotes aren't required, this'll still work.



Wildebraam Production wrote:

Is there a way to write an Excel function so it can read a variable and use
it as a reference?

For instance, to read a value from cell C1 in Sheet2 to A1 in Sheet1 I would
write the following function in A1:
=Sheet2!C1

But let's say I programmed a calculation that will give me an answer to cell
B1 in Sheet1, where the answer could be either Sheet2, Sheet3 or Sheet4. How
do I write the new function in cell A1 so it will use the result in B1 in
it's function, for instance;
=(Value in B1)!C1



--

Dave Peterson
 
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
Variable file reference Michael Excel Worksheet Functions 2 October 7th 08 06:37 PM
A function to get a variable row reference for range in XNPV funct Tex1960 Excel Worksheet Functions 6 August 1st 05 11:20 PM
How to use variable in reference Ming Excel Worksheet Functions 2 July 27th 05 11:24 PM
MIN Function w/ variable address reference WLMPilot Excel Worksheet Functions 7 June 10th 05 07:56 PM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


All times are GMT +1. The time now is 11:26 AM.

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

About Us

"It's about Microsoft Excel"