Solved

If statement with multiple values

Posted on 2016-09-20
7
40 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 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 46

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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 46

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 46

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

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.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

790 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