+ Reply to Thread
Results 1 to 5 of 5

Serach for text

  1. #1
    Registered User
    Join Date
    01-19-2005
    Location
    Brisbane
    Posts
    3

    Question Serach for text

    I need to find either a 4 character string from text which starts with WP.

    I have used the following function:
    =UPPER(MID(H482,SEARCH("wp",H482,1),4))

    from text such as MSI wp69

    But the problem I have is, what if there is a gap between the WP & the 69? How can I get it to find it if there is a gap? (eg can I check it theres a space after the WP, and if there is select 5 characters?)

    Thanks

    Rodney

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Try

    =UPPER(MID(H482,SEARCH("wp",H482),4+(MID(H482,SEARCH("wp",H482)+2,1)=" ")))

  3. #3
    Registered User
    Join Date
    01-19-2005
    Location
    Brisbane
    Posts
    3

    Talking Trim?

    thanks Daddylonglegs,

    can I get the result to be trimmed ie only 4 chraracters? eg WP69 (without space)

    Cheers

    Rod

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    You can adapt the above, i.e.

    =SUBSTITUTE(UPPER(MID(H482,SEARCH("wp",H482),4+(MID(H482,SEARCH("wp",H482)+2,1)=" ")))," ","")

    or perhaps a slightly different approach

    =UPPER(LEFT(SUBSTITUTE(REPLACE(H482,1,SEARCH("wp",H482)-1,"")," ",""),4))

  5. #5
    Registered User
    Join Date
    01-19-2005
    Location
    Brisbane
    Posts
    3

    Thumbs up

    excellent, the top one works.

    Thanks you very much, this is my first time here & I'm very impressed with the result!

    Thanks

    Rod

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1