+ Reply to Thread
Results 1 to 7 of 7

Find Exact Match Text String Using Formula

  1. #1
    Registered User
    Join Date
    04-21-2009
    Location
    Puyallup, WA
    MS-Off Ver
    Excel 2010
    Posts
    55

    Find Exact Match Text String Using Formula

    My question
    In the attached spreadsheet, I have highlighted an example that illustrates my problem. "Bow" windows are a type of window. However, keywords that contain the text string "bowie" (which is a city in maryland) are being labeled as "Bow".

    How do I modify my formula to look up EXACT MATCH text strings only?

    Keyword Labeling Formula.xlsx

    I have this crazy formula that looks for values in a list of keywords. Where it finds a given value, it will label it by assigning the header label to the keyword. If no value is found, it calls the label "Uncategorized".

    Please Login or Register  to view this content.
    I did not come up with this awesome formula, user NBVC did here:
    http://www.excelforum.com/excel-form...57#post2914657

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Find Exact Match Text String Using Formula

    sweetrevelation,

    Surround the text you're searching, and the text you're searching for, with spaces within the formula, like so:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-21-2009
    Location
    Puyallup, WA
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Find Exact Match Text String Using Formula

    Thanks tigeravatar.

    I'm trying to understand how this formula works. The questions I have are:
    1. What does this part of the formula do? "||" It's just a text string with two pipe characters. Does that have a special meaning in Excel or is that literally just a text string with two pipe symbols?
    2. I see your modification was to add empty spaces " " at the beginning and ending. How does your formula work for keywords that begin with or end with the text strings? For example, if the keyword was "replacement windows michigan", doesn't your formula look for " "replacement windows" " and therefore, since "replacement windows michigan" BEGINS with "replacement windows" and not " "replacement windows" " (with the space in front of this) how does your modification to the formula work?

    Thanks for any clarification you can provide. I hate bothering people for help but your help in understanding is so much appreciated!

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Find Exact Match Text String Using Formula

    Yes, its just 2 pipes. That is so that the formula cannot accidentally find a keword that includes a pipe symbol (if you had any) since there's no reason to have a keyword with 2 consecutive pipes. a keyword with 1 pipe is plausible, so by itself it won't do.

    As for the spaces, in the formula, it adds spaces around the keywords:
    " "&$E$2:$AG$100&" "

    And then it also adds spaces around the text being searched:
    " "&A10&" "

    So the text "replacement windows michigan" becomes " replacement windows michigan " so that it can find " replacement windows ".

  5. #5
    Registered User
    Join Date
    04-21-2009
    Location
    Puyallup, WA
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Find Exact Match Text String Using Formula

    Quote Originally Posted by tigeravatar View Post
    Yes, its just 2 pipes. That is so that the formula cannot accidentally find a keword that includes a pipe symbol (if you had any) since there's no reason to have a keyword with 2 consecutive pipes. a keyword with 1 pipe is plausible, so by itself it won't do.

    As for the spaces, in the formula, it adds spaces around the keywords:
    " "&$E$2:$AG$100&" "

    And then it also adds spaces around the text being searched:
    " "&A10&" "

    So the text "replacement windows michigan" becomes " replacement windows michigan " so that it can find " replacement windows ".
    That's an incredibly smart way that I never thought of. Thanks so much for your explanation and expertise.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Find Exact Match Text String Using Formula

    Quote Originally Posted by tigeravatar View Post
    Yes, its just 2 pipes. That is so that the formula cannot accidentally find a keword that includes a pipe symbol (if you had any) since there's no reason to have a keyword with 2 consecutive pipes. a keyword with 1 pipe is plausible, so by itself it won't do.
    Actually in this case, the || was meant to "virtually" fill blank cells in the keyword table with that symbol. Since the number of keywords beneath each category are not necessarily equal, it is necessary to do this virtual replacement... other the search formula will assume a blank is a legitimate "keyword" and every cell in column B that does not have a keyword in the first column of keywords, will take on the category that contains the first blank cell adjacent to a cell that is not blank to the left of it.

    As a test, try this formula:

    Please Login or Register  to view this content.
    CSE confirmed and copied down.... if your E1:AG100 list has uneven filled rows, then you should see some cells with incorrect categories...

    using Tigeravatar's version with the " " will yield 0 in those "non matching cells" if you were to take out the || substitution.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  7. #7
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Find Exact Match Text String Using Formula

    Ah cool, I should have tried it without the pipes to be sure. Thanks for the clarification, NBVC

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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