# IF Function Help with Wildcard

#### KuraiChikara

##### Board Regular
Hello,
I am trying to incorporate the wildcard "*" into an IF function and I'm not sure what's wrong so I will break down what I am attempting to do.

Process:
In column A I could have various days of the week formats that go from Friday to Thursday and they look like this
F--MTWR
FY--TWR
FYS--WR
etc, etc.

I already utilize a COUNT IF function with a wildcard to help me count weeks that might have an M for Monday or T for Tuesdays.
In my three week examples above, using this formula =COUNTIF(\$A\$1:\$A\$3,"*M*") does return a 1, because only 1 of those days has an M for Monday.

My problem
I'm now trying to use a similar wildcard process in an IF statement, but I can't seem to get it to work.

If column A1 has the following day of the week in it F--MTWR
I'm trying to us an IF statement to place certain days of the week if they contain certain letters.

In column B1 I put in the formula =IF(A1="*M*",A1,"") but I just get a blank placement.

For me, to help understand excel, I verbalize the problem: If cell A1 contains an M, put in the contents of A1, otherwise if not M, put blank.
The result however that I receive is blank.

### Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

#### Fluff

##### MrExcel MVP, Moderator
You cannot use wildcards in IF like that, try
Excel Formula:
``=IF(ISNUMBER(SEARCH("M",A1)),A1,"")``

#### KuraiChikara

##### Board Regular
That works, thank you very much.

My biggest issue with excel is I understand it pretty well but still not well enough.
Because I know understanding the requirements of each argument is key like equality/inequality formulas or functions that return a boolean function and I usually can't break excel that far down which is why I ask for help.

I'm still trying to learn but I get frustrated when one function works in a certain setup and a different function will not work with the same setup.
Thank you again.

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.
I get frustrated when one function works in a certain setup and a different function will not work with the same setup.
I know what you mean.

Replies
10
Views
155
Replies
24
Views
1K
Replies
7
Views
189
Replies
1
Views
86
Replies
11
Views
442

1,127,861
Messages
5,627,314
Members
416,239
Latest member
Counselor85027

### 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.

### Which adblocker are you using?

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

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