LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Between to values

The check is made progressively, so you don't need a lower bound


If TemperaturInput <= 10 Then
PoFResult = 5
ElseIf TemperaturInput =< 15 Then
PoFResult = 4

10 or less would be assigned a 5 in this case because it meets the first
criteria. Anything greater than 10 would go to the EndIF to be evaluated.
Items Less than or equal to 15 (but only those greater than 10 would get
this far) would be assigned 4

--
Regards,
Tom Ogilvy


"Michael" wrote in message
...
Thank's

I didn't think about the exact numbers 15, 20 etc

Could i use something like this.
If TemperaturInput <= 10 Then
PoFResult = 5
ElseIf TemperaturInput = 10 And TemperaturInput =< 15 Then
PoFResult = 4

or

If TemperaturInput <10 Then
PoFResult = 5
elseif TemperaturInput = 10 then
PoFResult = 5



"Bob Phillips" wrote:

You want AND

If TemperaturInput < 10 Then
PoFResult = 5
ElseIf TemperaturInput 10 And TemperaturInput < 15 Then
PoFResult = 4
ElseIf TemperaturInput 15 And TemperaturInput < 20 Then
PoFResult = 3
ElseIf TemperaturInput 20 And TemperaturInput < 25 Then
PoFResult = 2
ElseIf TemperaturInput 25 Then
PoFResult = 1
End If

But waht about 15, 20 and 25. You test for and < but not =.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Michael" wrote in message
...
Hi!
I have a VB formula that look like this.

TemperaturInput=FrmSeawaterParameter25CrSDSS.TxtTe mperature.Value

If TemperaturInput < 10 Then
PoFResult = 5
ElseIf TemperaturInput 10 Or TemperaturInput < 15 Then
PoFResult = 4
ElseIf TemperaturInput 15 Or TemperaturInput < 20 Then
PoFResult = 3
ElseIf TemperaturInput 20 Or TemperaturInput < 25 Then
PoFResult = 2
ElseIf TemperaturInput 25 Then
PoFResult = 1
End If

My problem is that this is not correct, if a set TemperaturInput=17 on

this
i will get
PoFResult =4 and that is NOT correct!

What is wrong?






 
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
Excel 2007 doesnt show Y-axis values when the values are small. outback Charts and Charting in Excel 2 October 26th 08 01:37 AM
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row Sam via OfficeKB.com Excel Worksheet Functions 5 February 9th 08 03:07 AM
Search/Filter to find values in another range based on two cell values Andy Excel Programming 2 April 29th 04 04:08 PM
How do I search thr'o column and put unique values in differnt sheet and sum corresponding values in test test Excel Programming 3 September 9th 03 08:53 PM
Predict Y-values on new X-values based on other actual X and Y values? NorTor Excel Programming 2 August 10th 03 03:08 PM


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