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

I am using the following select case statement:
Public Function adjgd(grade As Single)
Select Case grade
Case Is <= 0.0249
adjgd = 0
Case 0.025 To 0.0749
adjgd = 1
Case 0.075 To 0.1249
adjgd = 2
Case Is 0.1249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

I would like to select on cases with negative values. Anyone able to help?

Thanks in advance







--
M.R. Vanatta
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default Select Case

What do you mean by: I would like to select on cases with negative values ?
How about: Case is < 0
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mike V" wrote in message
...
I am using the following select case statement:
Public Function adjgd(grade As Single)
Select Case grade
Case Is <= 0.0249
adjgd = 0
Case 0.025 To 0.0749
adjgd = 1
Case 0.075 To 0.1249
adjgd = 2
Case Is 0.1249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

. Anyone able to help?

Thanks in advance







--
M.R. Vanatta



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Select Case

Bernard's question is pretty much the one I have too. To go into a little
more detail... do you want to trap any and all negative values as Bernard's
"Case Is < 0" would handle or do you want to trap a series of steps in a
range as you are now doing for positive numbers. If the latter, what are the
step points and what values do you want to assign to the 'adjgd' variable
for them?

--
Rick (MVP - Excel)


"Bernard Liengme" wrote in message
...
What do you mean by: I would like to select on cases with negative values
?
How about: Case is < 0
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mike V" wrote in message
...
I am using the following select case statement:
Public Function adjgd(grade As Single)
Select Case grade
Case Is <= 0.0249
adjgd = 0
Case 0.025 To 0.0749
adjgd = 1
Case 0.075 To 0.1249
adjgd = 2
Case Is 0.1249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

. Anyone able to help?

Thanks in advance







--
M.R. Vanatta




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

I woant to use the same value as in the example, only negative rather than
positiion values,
i.e.,
Case Is <=-0.02499
adjgd = 0
Case Is -0.025 To -0.0749
adjgd = 1
Case IS -0.075 To -01.249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

It treates the (-) as a positive value.

Hope that helps!!
--
M.R. Vanatta


"Rick Rothstein" wrote:

Bernard's question is pretty much the one I have too. To go into a little
more detail... do you want to trap any and all negative values as Bernard's
"Case Is < 0" would handle or do you want to trap a series of steps in a
range as you are now doing for positive numbers. If the latter, what are the
step points and what values do you want to assign to the 'adjgd' variable
for them?

--
Rick (MVP - Excel)


"Bernard Liengme" wrote in message
...
What do you mean by: I would like to select on cases with negative values
?
How about: Case is < 0
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mike V" wrote in message
...
I am using the following select case statement:
Public Function adjgd(grade As Single)
Select Case grade
Case Is <= 0.0249
adjgd = 0
Case 0.025 To 0.0749
adjgd = 1
Case 0.075 To 0.1249
adjgd = 2
Case Is 0.1249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

. Anyone able to help?

Thanks in advance







--
M.R. Vanatta





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Select Case

Change your Select Case statement to this...

Select Case Abs(grade)

--
Rick (MVP - Excel)


"Mike V" wrote in message
...
I woant to use the same value as in the example, only negative rather than
positiion values,
i.e.,
Case Is <=-0.02499
adjgd = 0
Case Is -0.025 To -0.0749
adjgd = 1
Case IS -0.075 To -01.249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

It treates the (-) as a positive value.

Hope that helps!!
--
M.R. Vanatta


"Rick Rothstein" wrote:

Bernard's question is pretty much the one I have too. To go into a little
more detail... do you want to trap any and all negative values as
Bernard's
"Case Is < 0" would handle or do you want to trap a series of steps in a
range as you are now doing for positive numbers. If the latter, what are
the
step points and what values do you want to assign to the 'adjgd' variable
for them?

--
Rick (MVP - Excel)


"Bernard Liengme" wrote in message
...
What do you mean by: I would like to select on cases with negative
values
?
How about: Case is < 0
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Mike V" wrote in message
...
I am using the following select case statement:
Public Function adjgd(grade As Single)
Select Case grade
Case Is <= 0.0249
adjgd = 0
Case 0.025 To 0.0749
adjgd = 1
Case 0.075 To 0.1249
adjgd = 2
Case Is 0.1249
adjgd = 3
Case Else
adjgd = 0
End Select
End Function

. Anyone able to help?

Thanks in advance







--
M.R. Vanatta





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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Case Select Daviv Excel Programming 2 March 5th 07 03:56 PM
End Select without Select Case, Block If without End If errors Atreides Excel Programming 12 November 17th 06 05:10 PM
For Each with Select Case helmekki[_28_] Excel Programming 2 October 15th 04 03:23 AM


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