![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Posts: 130
|
how to use a wildcard character in an IF statement
what is the formula for inserting a wilcard character in an IF statemnt |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Posts: 130
|
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 |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
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 ] |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Hilo, Hawaii
Posts: 240
|
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 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|