ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Worksheet reference syntax? (https://www.excelbanter.com/excel-discussion-misc-queries/185089-worksheet-reference-syntax.html)

Matt

Worksheet reference syntax?
 

I have a workbook that contains several tabs named by years (eg Y2001,
Y2002, Y2003...).

Is there a syntax that would reference a cell whose worksheet is based
on the result of a formula? So, for example, if the formula resulted
in 2002, it would return the A1 value in the Y2002 worksheet instead
of any of the others

Something like this perhaps?

="Y"&formula_that_gives_a_year_value!A1


David Biddulph[_2_]

Worksheet reference syntax?
 
You need the INDIRECT function.
--
David Biddulph

"Matt" wrote in message
...

I have a workbook that contains several tabs named by years (eg Y2001,
Y2002, Y2003...).

Is there a syntax that would reference a cell whose worksheet is based
on the result of a formula? So, for example, if the formula resulted
in 2002, it would return the A1 value in the Y2002 worksheet instead
of any of the others

Something like this perhaps?

="Y"&formula_that_gives_a_year_value!A1




Pete_UK

Worksheet reference syntax?
 
You need to do it like this:

=INDIRECT("'Y" & your_formula & "'!A1")

The apostrophes are in there in case you have spaces in the sheet
names.

Hope this helps.

Pete

On Apr 25, 1:02*pm, Matt wrote:
I have a workbook that contains several tabs named by years (eg Y2001,
Y2002, Y2003...).

Is there a syntax that would reference a cell whose worksheet is based
on the result of a formula? *So, for example, if the formula resulted
in 2002, it would return the A1 value in the Y2002 worksheet instead
of any of the others

Something like this perhaps?

="Y"&formula_that_gives_a_year_value!A1



Matt

Worksheet reference syntax?
 
Perfect, thanks!


All times are GMT +1. The time now is 08:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com