Solved

If statement with multiple values

Posted on 2016-09-20
7
43 Views
Last Modified: 2016-09-20
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
Comment
Question by:Ladkisson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41806875
You can use the OR operator:

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

Author Comment

by:Ladkisson
ID: 41806890
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
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41806894
Or in VBA...

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

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 41806896
You can't just use "K", it has to be a cell address like K2, or K99.
0
 

Author Comment

by:Ladkisson
ID: 41806897
no VBA please. Thanks!
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41806908
Dare I suggest you have accepted the wrong solution???
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 41806916
Dare I suggest you have accepted the wrong solution???
Yes I agree. Rob should get the points.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question