Solved

If statement with multiple values

Posted on 2016-09-20
7
33 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 31

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 45

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 45

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 31

Expert Comment

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now