Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default referencing named formula using INDIRECT function

Hi,

I'm having some problems using the INDIRECT function to reference a
named formula on a different sheet. I want to be able to put the name
of the sheet in one row (as a table header) and the use the INDIRECT
function to reference a particular named formula that is on that sheet.
As an example, on sheet 'Summary' i want to put 'London' in one cell
and then below that put =INDIRECT(cellabove&"!MonthSales) rather than
putting =London!MonthSales. I want to do this partly so i don't have
to copy new formulas for new sheets and also for data security - so i
don't accidently reference the wrong sheet.

However, the INDIRECT() formula returns #ref!

I think the problem is with the definition of the named formula
(MonthSales) on the 'London' sheet because it requires the return of a
variable using the CELL('filename') function, and the ROW(). I'm
guessing that when you use the INDIRECT function, the formula no longer
'knows' which cell it is in??

The MonthSales named formula is defined as follows:

WorksheetName=RIGHT(CELL("filename"),LEN(CELL("fil ename"))-FIND("]",CELL("filename")))

MonthSales==VLOOKUP(INDIRECT(WorksheetName&"!$A"&2 +ROW()+2),London!data,2,FALSE)

The formula, although a little complicated, does work if i reference it
using the London!MonthSales syntax but not the INDIRECT() syntax. Can
anyone shed some light on this and say whether there is a
workaround/point out what i'm doing wrong.

Thanks
Rob

  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

You need to use quotes for the named cell, i.e. assume the cell above is C2


=INDIRECT("'"&C2&"'!MonthSales")



--
Regards,

Peo Sjoblom


wrote in message
oups.com...
Hi,

I'm having some problems using the INDIRECT function to reference a
named formula on a different sheet. I want to be able to put the name
of the sheet in one row (as a table header) and the use the INDIRECT
function to reference a particular named formula that is on that sheet.
As an example, on sheet 'Summary' i want to put 'London' in one cell
and then below that put =INDIRECT(cellabove&"!MonthSales) rather than
putting =London!MonthSales. I want to do this partly so i don't have
to copy new formulas for new sheets and also for data security - so i
don't accidently reference the wrong sheet.

However, the INDIRECT() formula returns #ref!

I think the problem is with the definition of the named formula
(MonthSales) on the 'London' sheet because it requires the return of a
variable using the CELL('filename') function, and the ROW(). I'm
guessing that when you use the INDIRECT function, the formula no longer
'knows' which cell it is in??

The MonthSales named formula is defined as follows:

WorksheetName=RIGHT(CELL("filename"),LEN(CELL("fil ename"))-FIND("]",CELL("filename")))

MonthSales==VLOOKUP(INDIRECT(WorksheetName&"!$A"&2 +ROW()+2),London!data,2,FALSE)

The formula, although a little complicated, does work if i reference it
using the London!MonthSales syntax but not the INDIRECT() syntax. Can
anyone shed some light on this and say whether there is a
workaround/point out what i'm doing wrong.

Thanks
Rob


  #3   Report Post  
Rob Hick
 
Posts: n/a
Default

thanks for the tip Peo, but it doesn't seem to have worked. All the
names of the worksheets are single words (no spaces) so it shouldn't
matter whether I have quotes or not (if I've understood you correctly)

  #4   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

=INDIRECT(cellabove&"!A1")

worked for me.

--

Vasant

"Rob Hick" wrote in message
oups.com...
thanks for the tip Peo, but it doesn't seem to have worked. All the
names of the worksheets are single words (no spaces) so it shouldn't
matter whether I have quotes or not (if I've understood you correctly)



  #5   Report Post  
Rob Hick
 
Posts: n/a
Default

that not quite what i was after Vasant - i need to reference the name
rather than 'A1'. So on my workbook (XL2000):

=London!MonthSales
is ok but
=INDIRECT("London!MonthSales")
or any permuation of getting the correct text, does not work

Rob



  #6   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

How is the name defined? Go to insertnamedefine and select MonthSales, now if
it for sinstance says something like =London!$C$2

then you can use

=INDIRECT("MonthSales")

This also works for me

=INDIRECT("London!MonthSales")

assuming that London is the sheet name and not the workbook name

Regards,

Peo Sjoblom



"Rob Hick" wrote:

that not quite what i was after Vasant - i need to reference the name
rather than 'A1'. So on my workbook (XL2000):

=London!MonthSales
is ok but
=INDIRECT("London!MonthSales")
or any permuation of getting the correct text, does not work

Rob


  #7   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

Again, under the scenario you described:

=INDIRECT(cellabove&"!MonthSales")

works just fine for me.

"cellabove" is a named formula that returns the contents of the cell above
it. The cell above it contains the text "London". The sheet named London has
a named range called MonthSales. The above formula returns the contents of
this range.

I don't see the problem.

--

Vasant


"Rob Hick" wrote in message
oups.com...
that not quite what i was after Vasant - i need to reference the name
rather than 'A1'. So on my workbook (XL2000):

=London!MonthSales
is ok but
=INDIRECT("London!MonthSales")
or any permuation of getting the correct text, does not work

Rob



  #8   Report Post  
Harlan Grove
 
Posts: n/a
Default

wrote...
....
The MonthSales named formula is defined as follows:

WorksheetName=RIGHT(CELL("filename"),
LEN(CELL("filename"))-FIND("]",CELL("filename")))


Do you mean WorksheetName is defined as above?

What does the cell formula

="["&WorksheetName&"]"

return?

MonthSales==VLOOKUP(INDIRECT(WorksheetName&"!$A "
&2+ROW()+2),London!data,2,FALSE)


Why 2+ROW()+2 rather than ROW()+4?

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
INDIRECT Function and Autofill Neil Grantham Excel Worksheet Functions 1 April 21st 05 12:22 AM
indirect worksheet function in excel richard_annor Excel Worksheet Functions 1 March 6th 05 11:10 PM
INDIRECT function error Anthony Slater Excel Discussion (Misc queries) 3 February 21st 05 06:26 PM
formula referencing another workbook Steve D Excel Worksheet Functions 2 January 7th 05 09:43 PM
Can I use TODAY Function in formula without it changing the next . Tucson Guy Excel Discussion (Misc queries) 1 December 19th 04 09:47 AM


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