Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: how to use a wildcard character in an IF statement

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    128
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    how to use a wildcard character in an IF statement

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

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Posts
    128
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #4
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Keaau, Hawaii
    Posts
    238
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •