Results 1 to 4 of 4
  1. #1
    3 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    220
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Using IF to find a text string within a text string

    I think that I may have to use FIND or another function with IF, but I want to find the number 5434579711 in strings like the following:

    h,ttp://www.abcde.com/photo_view.html?uid=5434579711&photoId=225234602#s tate=4

    If it were easy, I could do IF(a1="*5434579711*", joe, mary). While I think that I could use this or a similar approach in SQL, I can't in Excel. Thanks!
    JimmyW
    Helena, MT

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Something like this perhaps:
    =IF(ISNUMBER(FIND("5434579711",A1)), "joe", "mary")

    Steve

  3. #3
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,643
    Thanks
    115
    Thanked 652 Times in 594 Posts
    Perhaps even better is using search instead of find. It is not case sensitive and you can use wildcards "?" or "*"

    =IF(ISNUMBER(SEARCH("5434579711",A1)), "joe", "mary")

    or

    =IF(ISNUMBER(SEARCH("543457?711",A1)), "joe", "mary")

    or

    =IF(ISNUMBER(SEARCH("543457*",A1)), "joe", "mary")

    HTH,
    Maud

  4. #4
    3 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    220
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Thanks very much, Steve and Maud, for your usual splendid advice! I went with Maud's suggestion, which worked perfectly.
    JimmyW
    Helena, MT

Posting Permissions

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