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

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
Ladkisson
Asked:
Ladkisson
  • 3
  • 2
  • 2
1 Solution
 
Rob HensonFinance AnalystCommented:
You can use the OR operator:

=IF(OR(B2=25,B2=41,B2=75),"Correct","Incorrect")
0
 
LadkissonAuthor 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
 
Martin LissOlder than dirtCommented:
Or in VBA...

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

Open in new window

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Martin LissOlder than dirtCommented:
You can't just use "K", it has to be a cell address like K2, or K99.
0
 
LadkissonAuthor Commented:
no VBA please. Thanks!
0
 
Rob HensonFinance AnalystCommented:
Dare I suggest you have accepted the wrong solution???
0
 
Martin LissOlder 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.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now