Issue with OR or Wildcard?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
919
Office Version
  1. 365
  2. 2019
I'm trying to make a formula where if a cell begins with X, Y, or Z, it shows Deprioritized, otherwise it shows Prioritized. However, my current formula is showing Prioritized for all results. Am I using the OR wrong, or is my wildcard wrong?

Excel Formula:
=IF(OR(C2="X*",C2="Y*",C2="Z*"),"Deprioritized","Prioritized")

Thanks!
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try this:

Excel Formula:
=IF(OR(COUNTIF(C2,{"X*","Y*","Z*"})),"Deprioritized","Prioritized")
 
Upvote 1
Solution
Or try:

Excel Formula:
=IF(OR(LEFT(C2,1)={"X","Y","Z"}),"Deprioritized","Prioritized")
 
Upvote 1
I'm trying to make a formula where if a cell begins with X, Y, or Z, it shows Deprioritized, otherwise it shows Prioritized. However, my current formula is showing Prioritized for all results. Am I using the OR wrong, or is my wildcard wrong?

Excel Formula:
=IF(OR(C2="X*",C2="Y*",C2="Z*"),"Deprioritized","Prioritized")

Thanks!
Or this:

=IF(OR(COUNTIF($C2,"X*")=1, COUNTIF($C2,"Y*")=1, COUNTIF($C2,"Z*")=1), "Deprioritized","Prioritized")

Wildcards aren't recognised with comparison operators like =, for example if you use this formula
=A1="*&*"
that will treat the asterisks as literal asterisks (not wildcards) so that will only return TRUE if A1 literally contains *&*
 
Upvote 1
Thank you so much for your replies. Used the first solution from Phuoc
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top