Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
slm slm is offline
external usenet poster
 
Posts: 3
Default Use varaible for worsheet name in a formule

Hi,

In a workbook, I have several worksheet with some figures related to a
specific year (one worksheet by year).
I have a worksheet to perform some calculation and so I use formulas like
this:
=YE04!B5-YE01!B5 where YE04 and YE01 are worsheet names.

I want to use variable to reference worsheet name. Variables will be two
cells in a separate worksheet where I put worsheet names to use.
1rst variable, called "start",will be cell A3 in worsheet "Reference" and
2nd varaible, called "end", will be cell B3 in worsheet "Reference".
I want to be able to write formula like =start!B5-end!B5.

Is it possible? if yes how to do?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Use varaible for worsheet name in a formule

=INDIRECT(Reference!A3&"!B5")-INDIRECT(Reference!B3&"!B5)

--
HTH

Bob Phillips

"slm" wrote in message
...
Hi,

In a workbook, I have several worksheet with some figures related to a
specific year (one worksheet by year).
I have a worksheet to perform some calculation and so I use formulas like
this:
=YE04!B5-YE01!B5 where YE04 and YE01 are worsheet names.

I want to use variable to reference worsheet name. Variables will be two
cells in a separate worksheet where I put worsheet names to use.
1rst variable, called "start",will be cell A3 in worsheet "Reference" and
2nd varaible, called "end", will be cell B3 in worsheet "Reference".
I want to be able to write formula like =start!B5-end!B5.

Is it possible? if yes how to do?

Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use varaible for worsheet name in a formule


For example (do not use the apostrophes in the following) :-

1. Insert/Name/Define 2 cells with names 'start' and 'end'
2. In the 'start' cell I put 'Sheet1'
3. In the 'end' cell I put 'Sheet2'

I can now use the formula :-
=INDIRECT(CONCATENATE(end,"!","A1"))-INDIRECT(CONCATENATE(start,"!","A1"))

In the formula the range A1 is an explicit string with quotes.
It would be possible to use cell contents as for the sheet names
instead.


--
BrianB


------------------------------------------------------------------------
BrianB's Profile: http://www.excelforum.com/member.php...info&userid=55
View this thread: http://www.excelforum.com/showthread...hreadid=388283

  #4   Report Post  
Posted to microsoft.public.excel.programming
slm slm is offline
external usenet poster
 
Posts: 3
Default Use varaible for worsheet name in a formule

It works well.

Thanks you very much


"Bob Phillips" wrote:

=INDIRECT(Reference!A3&"!B5")-INDIRECT(Reference!B3&"!B5)

--
HTH

Bob Phillips

"slm" wrote in message
...
Hi,

In a workbook, I have several worksheet with some figures related to a
specific year (one worksheet by year).
I have a worksheet to perform some calculation and so I use formulas like
this:
=YE04!B5-YE01!B5 where YE04 and YE01 are worsheet names.

I want to use variable to reference worsheet name. Variables will be two
cells in a separate worksheet where I put worsheet names to use.
1rst variable, called "start",will be cell A3 in worsheet "Reference" and
2nd varaible, called "end", will be cell B3 in worsheet "Reference".
I want to be able to write formula like =start!B5-end!B5.

Is it possible? if yes how to do?

Thanks





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
Hyperlink varaible substitution - How To Sledge Bacon Excel Worksheet Functions 10 May 29th 08 06:03 PM
Disappearance of assigned value of varaible when working with form vbaprog Excel Programming 7 January 19th 05 11:39 PM
need help with a formule sebasjuh Excel Programming 3 June 3rd 04 04:32 PM
formule Natiq Hason Excel Programming 1 May 15th 04 09:33 PM
Passing a named varaible to Excel's Autofilter Jeff Glock Excel Programming 1 December 23rd 03 04:46 PM


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