how to use a wildcard character in an IF statement

smittycft99

Board Regular
Joined
Apr 16, 2002
Messages
128
how to use a wildcard character in an IF statement

what is the formula for inserting a wilcard character in an IF statemnt
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
On 2002-04-19 10:09, smittycft99 wrote:
how to use a wildcard character in an IF statement

what is the formula for inserting a wilcard character in an IF statemnt

Please explain.
 
Upvote 0
Wildcard characters
The following wildcard characters can be used as comparison criteria for filters, and when searching and replacing content.

Used To find
? (question mark) Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk) Any number of characters
For example, *east finds "Northeast" and "Southeast"

I'm trying to help a colleague use wildcards in the logical test segment of the IF statement? I am not sure how he is using it? I am trying to get a hold of him
 
Upvote 0
Yes, I understand wildcards... I need to understand of how "he" wants to use them. The IF worksheet function doesn't employ wildcards itself. Its all in the function(s) used in IF's 1st argument -- its logical test.

For example, if A2:A7 contains...

{"Jack";"Jill";"Jan";"Larry";"Moe";"Curly"}

...then the formula...

=IF(ISNUMBER(SEARCH("J*",A2)),"J's","")

...produces {"J's";"J's";"J's";"";"";""}
This message was edited by Mark W. on 2002-04-19 10:52
 
Upvote 0
This will find words that end in ing if they are in cell A1 on the active sheet. I hope this is what your looking to do.

Option Explicit

Private Sub FindStar()
If ActiveSheet.Range("A1").Value Like ("*ing") Then'the key to making the wild card work is the LIKE keyword
MsgBox ("Found It")
Else
MsgBox ("NOT")
End If

End Sub


Yours in EXCELent Frustration
KniteMare
This message was edited by KniteMare on 2002-04-19 10:51
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

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