Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Worksheet name variables

I have a project that requires me to copy mutiple worksheets to one hub
worksheet. Is there a way to make the worksheet name a variable?
This is what i have so far:

=IF(Period8224a!$R$9=$C$2,Period8224a!$N$9,0)

The Period8224a name will change like 50 to 100 times. If there was a way
to reference the name of the sheet from a cell on the hub sheet like this:

=IF("X1"!$R$9=$C$2,"X1"!$N$9,0)

with the "X1" cell containing the worksheet name.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 342
Default Worksheet name variables

You can use the €śIndirect€ť function to get the name of the worksheet into a
formula. Assume the name of the worksheet is in cell A9, this formula should
do what you want:

=IF(INDIRECT((A9)&"!$R$9")=$C$2,INDIRECT((A9)&"!$N $9"),0)

Tom

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Worksheet name variables

=if(indirect("'"&x1&"'!r9")=$c$2,indirect("'"&x1&" '!n9"),0)

The apostrophes are not always required. If you included them and excel doesn't
need them, it's not a problem.

But if you don't include them and excel needs them, excel will yell.

And since the stuff inside the =indirect() is a string, I didn't need to use the
$ in the address (for R9). It won't change when that formula is copied to other
cells.



ThunderBlade wrote:

I have a project that requires me to copy mutiple worksheets to one hub
worksheet. Is there a way to make the worksheet name a variable?
This is what i have so far:

=IF(Period8224a!$R$9=$C$2,Period8224a!$N$9,0)

The Period8224a name will change like 50 to 100 times. If there was a way
to reference the name of the sheet from a cell on the hub sheet like this:

=IF("X1"!$R$9=$C$2,"X1"!$N$9,0)

with the "X1" cell containing the worksheet name.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Worksheet name variables

Thank you both very much. I had never used the Indirect Function before.
Everything is working as planned.
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
Create an automatic worksheet with two variables Cisko Excel Worksheet Functions 0 March 22nd 10 10:11 PM
populating a master worksheet with variables in other worksheets Foxwave Excel Worksheet Functions 5 July 24th 07 06:06 AM
Counting multiple variables in a worksheet for summary on another E.W. Excel Worksheet Functions 2 May 25th 06 11:00 PM
constructing (complex) variables with worksheet functions broer konijn Excel Discussion (Misc queries) 0 May 16th 06 10:55 PM
Worksheet template variables Dennyz Excel Worksheet Functions 0 January 26th 05 02:15 AM


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