Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Formula to search for worksheet name, then calculate

I have a macro that I am running that adds sheets based on a list. I
have a summary sheet that has formulas based on the names. Without
getting the REF# error, is there anyway I can refer to a sheet that has
not been created?

Example formula: ='john smith'!D2:D17

John smith will not have a sheet until after I run the macro (to create
from the list).

I want the code to add the cells based on the condition that John Smith
sheet exist. If not, just remain blank.

Any help would be appreciated....

Thanx,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Formula to search for worksheet name, then calculate

What about If(iserr(sum('john smith'!D2:D17),"",sum('john
smith'!D2:D17) as your formula.

J.W. Aldridge wrote:
I have a macro that I am running that adds sheets based on a list. I
have a summary sheet that has formulas based on the names. Without
getting the REF# error, is there anyway I can refer to a sheet that has
not been created?

Example formula: ='john smith'!D2:D17

John smith will not have a sheet until after I run the macro (to create
from the list).

I want the code to add the cells based on the condition that John Smith
sheet exist. If not, just remain blank.

Any help would be appreciated....

Thanx,


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formula to search for worksheet name, then calculate

Seems like a pretty funny example formula.

=IF(ISERROR(CELL("address",INDIRECT("'john smith'!a1"))),"missing",
indirect("'john smith'!d2:d17"))

Change missing to what you want to see instead ("" maybe???).



"J.W. Aldridge" wrote:

I have a macro that I am running that adds sheets based on a list. I
have a summary sheet that has formulas based on the names. Without
getting the REF# error, is there anyway I can refer to a sheet that has
not been created?

Example formula: ='john smith'!D2:D17

John smith will not have a sheet until after I run the macro (to create
from the list).

I want the code to add the cells based on the condition that John Smith
sheet exist. If not, just remain blank.

Any help would be appreciated....

Thanx,


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Formula to search for worksheet name, then calculate


I couldn't get the first recommended forumula to take. The "" part kept
highlighting.

=If(iserr(sum('john smith'!D2:D17),"",sum('john smith'!D2:D17)


I got Dave's formula to return a value when I made it an array formula.
But I cant figure where to SUM would go so it would add the cell range
d2:d17.


Thanx.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Formula to search for worksheet name, then calculate

Sorry, missing right bracket. Try:

=If(iserr(sum('john smith'!D2:D17)),"",sum('john smith'!D2:D17)

J.W. Aldridge wrote:
I couldn't get the first recommended forumula to take. The "" part kept
highlighting.

=If(iserr(sum('john smith'!D2:D17),"",sum('john smith'!D2:D17)


I got Dave's formula to return a value when I made it an array formula.
But I cant figure where to SUM would go so it would add the cell range
d2:d17.


Thanx.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Formula to search for worksheet name, then calculate

Thanx both of you....

The last one worked like a charm!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formula to search for worksheet name, then calculate

Are you bothered by the dialog you get that asks you where that non-existent
sheet is?



"J.W. Aldridge" wrote:

Thanx both of you....

The last one worked like a charm!


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formula to search for worksheet name, then calculate

Or when you reopen the workbook?

Dave Peterson wrote:

Are you bothered by the dialog you get that asks you where that non-existent
sheet is?

"J.W. Aldridge" wrote:

Thanx both of you....

The last one worked like a charm!


--

Dave Peterson


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Formula to search for worksheet name, then calculate


Dave Peterson wrote:
Are you bothered by the dialog you get that asks you where that non-existent
sheet is?



The formulas I had in place returned the REF# error because the sheets
were not yet created. I was bothered by that error, but also by the
fact that when the sheet was actually added, the formula's reference to
that sheet would change to REF# as well. However, like I said above....
that last formula seemed to work out for me.

Thanx.

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
Search one worksheet to pull data into another worksheet HyperMite Excel Worksheet Functions 6 March 4th 09 01:53 PM
Search and calculate formula Xina5280 Excel Worksheet Functions 4 February 6th 08 10:09 PM
VBA Code to search and calculate. YellowBird Excel Programming 4 May 30th 06 10:31 PM
Formula to retrieve range of dates from a worksheet to calculate d accented Excel Worksheet Functions 0 January 10th 06 09:52 PM
Create a search Field within a worksheet to search command buttons Ed P[_2_] Excel Programming 1 December 14th 04 08:04 PM


All times are GMT +1. The time now is 07:09 PM.

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"