• Status: Solved
• Priority: Medium
• Security: Public
• Views: 58

# If statement with multiple values

Hello,

how should I write if statement for the following conditions:
if B is equals 25, if B is equals 41, if B equals 75, then return "correct" otherwise "incorrect"

thanks,
0
• 3
• 2
• 2
1 Solution

Finance AnalystCommented:
You can use the OR operator:

=IF(OR(B2=25,B2=41,B2=75),"Correct","Incorrect")
0

Author Commented:
it did not work

this is my formula:

=IF(OR(K=27.92,K=42.97,K=75.96,K=127.31,K=230.82),"correct","Incorrect")
0

Older than dirtCommented:
Or in VBA...

``````Select Case B
Case 25, 41, 75
Msgboc "correct"
Case Else
Msgbox "incorrect"
End Select
``````
0

Older than dirtCommented:
You can't just use "K", it has to be a cell address like K2, or K99.
0

Author Commented:
0

Finance AnalystCommented:
Dare I suggest you have accepted the wrong solution???
0

Older than dirtCommented:
Dare I suggest you have accepted the wrong solution???
Yes I agree. Rob should get the points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.