#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stumped

Hi

Im reading a collection of worksheets and printing totals under eac
classification in a final worksheet (Sheet1) which is at the end of th
tab of worksheets.

So I have

template - 163 sheets to read - totals (Sheet1)

Im reading N93 from each cell, which is a percentage ranging from -500
to 1300%.

For some reason, this is giving me an error. When I go to the debug, i
seems as though its gets confused when numRatios = 3.016

Below is the code, maybe fresh eyes will be able to see hte error..
Thanks for the help!

' Counts number of most adverse ratios
Count = Worksheets.Count
' exclude totals sheet
Amount = Count - 1
numRatio = 0
numLess0 = 0
num0to100 = 0
num100to150 = 0
num150to175 = 0
num175to200 = 0
numMore200 = 0
' start at second worksheet, exclude template
For i = 2 To Amount
numRatio = CDec(Worksheets(i).Range("N93"))
If numRatio < 0 Then
numLess0 = numLess0 + 1
ElseIf numRatio = 0 And numRatio <= 1 Then
num0to100 = num0to100 + 1
ElseIf numRatio 1 And numRatio <= 1.5 Then
num100to150 = num100to150 + 1
ElseIf numRatio 1.5 And numRatio <= 1.75 Then
num150to175 = num150to175 + 1
ElseIf numRatio 1.75 And numRatio <= 2 Then
num175to200 = num175to200 + 1
ElseIf numRatio 2 Then
numMore200 = numMore200 + 1
End If
Next
' prints number of scenarios presented
Sheet1.Range("D113").Value = numLess0
Sheet1.Range("D114").Value = num0to100
Sheet1.Range("D115").Value = num100to150
Sheet1.Range("D116").Value = num150to175
Sheet1.Range("D117").Value = num175to200
Sheet1.Range("D118").Value = numMore200


Thanks again

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stumped

Okay so i found that hte problem has to do with if the cell has #NUM! i
it.

How can I change hte formula
=SMALL($I$83:$I$102,1)

to be blank and not #NUM! if there are no valued in the range?

Thanks

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Stumped

=IF(ISERROR(SMALL($I$83:$I$102,1)),"",SMALL($I$83: $I$102,1))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Sheeny " wrote in message
...
Okay so i found that hte problem has to do with if the cell has #NUM! in
it.

How can I change hte formula
=SMALL($I$83:$I$102,1)

to be blank and not #NUM! if there are no valued in the range?

Thanks!


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stumped

THANK YOU SO MUCH!!!

That was killing me

--
Message posted from http://www.ExcelForum.com

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
Still stumped LarryK Excel Worksheet Functions 7 March 30th 09 11:15 AM
Stumped Formula question Excel Discussion (Misc queries) 1 April 16th 08 06:39 PM
Stumped Jake Excel Discussion (Misc queries) 4 November 21st 06 01:09 PM
I'm Stumped ExcelBob Excel Discussion (Misc queries) 8 May 25th 06 01:37 PM
stumped ?? my Excel Worksheet Functions 2 April 13th 06 12:32 PM


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

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"