Issue with OR or Wildcard?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
893
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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

Forum statistics

Threads
1,221,537
Messages
6,160,402
Members
451,644
Latest member
hglymph

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