Wildcard If Statment

leighmetcalfe

New Member
Joined
Oct 27, 2012
Messages
46
I'm struggling to use a wildcard with an if statement.

my formula is "=IF(OR(BZ1="99",BZ1="99"&"*"),"True","False")"

I need it to check the cell and if it has either 99 or variations of 99- then be true.
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi, if you want to test that it stats with 99 you could try:

=IF(LEFT(BZ1,2)="99","True","False")
 
Upvote 0
Solution
Another solutioun might be =IF(BZ1="99*"),"True","False")
 
Upvote 0
Hi,

Or, if you want to return the Logical TRUE/FALSE rather then the Text "True", "False":

=LEFT(BZ1,2)="99"
 
Upvote 0
I had need of a wild card came up with this > =IF(COUNTIF(S3:S3,"*A/S*"),1,IF(COUNTIF(S3:S3,"*HOSPITAL*"),1,IF(COUNTIF(S3:S3,"*UNKNOWN*"),1,IF(COUNTIF(S3:S3,"*NRECORDE*"),1,""))))

no idea if that is good practice or not, everything else I found was functions
 
Upvote 0
Hi mole999,

I'm making a couple of assumptions here:

1. You're looking in a Single cell (S3 for this sample)
2. You Don't want Partial strings like AA/SS, HOSPITALIZED, NRECORDED, etc. "mis" Counted

If point 2 above is correct, I would add a Space in front and after the Text string to be searched, so that the formula will only result True for those specific words:

=IF(ISNUMBER(LOOKUP(2,1/SEARCH({" A/S "," HOSPITAL "," UNKNOWN "," NRECORDE "}," "&S3&" "))),1,"")
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,384
Members
448,889
Latest member
TS_711

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