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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

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