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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,225,757
Messages
6,186,845
Members
453,379
Latest member
gabriellegonzalez

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