[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 51
  • 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 HensonIT & Database AssistantCommented:
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 LissRetired ProgrammerCommented:
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!

 
Martin LissRetired ProgrammerCommented:
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 HensonIT & Database AssistantCommented:
Dare I suggest you have accepted the wrong solution???
0
 
Martin LissRetired ProgrammerCommented:
Dare I suggest you have accepted the wrong solution???
Yes I agree. Rob should get the points.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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