View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Variable reference in a function

If Sheet1 A1 = "Sheet2"

The below formula will return A1 of Sheet2

=INDIRECT(A1 & "!A1")

If this post helps click Yes
---------------
Jacob Skaria


"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