Using wildcards in IF statement

halefamily104

New Member
Joined
Oct 11, 2016
Messages
31
Hello

I am trying to use wildcards in an If statement but cant seem to get it to work. Here is what I have so far

=IF(OR(ISNUMBER(SEARCH({"*FF*","*HV*","*CTC*","*CLC*"},I12:V12))),"Full","Error")

If I only reference one cell (I12) it works beautifully but when I add in the additional cells (I12:V12) for the formula to look at, this
formula does not return the correct value.

Any ideas?

Thanks


 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Are you looking to say "Full" if any of those codes are found in any of the cells of I12:V12? Then try:

=IF(OR(ISNUMBER(SEARCH({"FF";"HV";"CTC";"CLC"},I12:V12))),"Full","Error")
and confirm it with Control+Shift+Enter.

When you just had 1 cell to examine, you had a 1-d array formula. The array constant {} told Excel it was an array, so everything was fine. By changing I12 to I12:V12, it's now a 2-d array formula. This requires that you use CSE, but also it requires that one of the dimensions is horizontal (I12:V12), and the other dimension must be vertical. That's why I had to change the commas to semicolons in the array constant.

Other than that, you don't need the * when you use SEARCH.

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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