Issue with OR or Wildcard?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
921
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 the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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