Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Case without Select Case error problem | Excel Discussion (Misc queries) | |||
Case Select | Excel Programming | |||
End Select without Select Case, Block If without End If errors | Excel Programming | |||
For Each with Select Case | Excel Programming |