ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help on IF condition (https://www.excelbanter.com/excel-programming/386547-need-help-if-condition.html)

[email protected]

Need help on IF condition
 
I have been researching on if condition, but unable to get it work,

I have to write a IF comnditon for the folowing,

Dollars Points

$3.0 1
$4.0 2
$5.0 3
$6.0 4
$7.0 5
$8.0 6
$9.0 7
$10.0 8


If $ value is =3 then 1
if $ value is =3.5 and <4 then 2
iif $ value is =4.5 and <5 then 3

like wise,

If not possible with IF condition, please let me know for alternative
formule,

please help


JE McGimpsey

Need help on IF condition
 
What happens between 4 and 4.5?

One way, if I understand you correctly:

=ROUND(A1,0) - 2

In article .com,
wrote:

I have been researching on if condition, but unable to get it work,

I have to write a IF comnditon for the folowing,

Dollars Points

$3.0 1
$4.0 2
$5.0 3
$6.0 4
$7.0 5
$8.0 6
$9.0 7
$10.0 8


If $ value is =3 then 1
if $ value is =3.5 and <4 then 2
iif $ value is =4.5 and <5 then 3

like wise,

If not possible with IF condition, please let me know for alternative
formule,

please help


urkec

Need help on IF condition
 
You can use select case (adjust case clauses )

Dim Dollars As Currency
Dim Points As Integer

Dollars = 7.3

Select Case Dollars
Case 0.1 To 3.5
Points = 1
Case 3.6 To 4.5
Points = 2
Case 4.6 To 5.5
Points = 3
Case 5.6 To 6.5
Points = 4
Case 6.6 To 7.5
Points = 5
Case 7.6 To 8.5
Points = 6
Case 8.6 To 9.5
Points = 7
Case 9.6 To 10
Points = 8
Case Else
Points = 0
End Select

MsgBox Points

--
urkec


" wrote:

I have been researching on if condition, but unable to get it work,

I have to write a IF comnditon for the folowing,

Dollars Points

$3.0 1
$4.0 2
$5.0 3
$6.0 4
$7.0 5
$8.0 6
$9.0 7
$10.0 8


If $ value is =3 then 1
if $ value is =3.5 and <4 then 2
iif $ value is =4.5 and <5 then 3

like wise,

If not possible with IF condition, please let me know for alternative
formule,

please help




All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com