+ Reply to Thread
Results 1 to 6 of 6

Help to modify formula so that it only searches for whole string

  1. #1
    Registered User
    Join Date
    11-09-2009
    Location
    Shropshire UK
    MS-Off Ver
    Excel 365
    Posts
    38

    Question Help to modify formula so that it only searches for whole string

    Hi.

    I have a workbook which contains a column of number values delimited with the pipeline character (column A). I want to return category names to column B based on a lookup of another sheet (Categories). My formula is looking for every character due to the SEARCH function, but I only want it to search for whole strings. I've tried lots of other formulas that I've seen online but none of them seem to work for what I want.

    In summary:
    'Product Import' sheet has pipeline delimited values in column A
    'Categories' sheet has an array A2:B73 with column B containing the value I want returned to 'Product Import' Column B

    Any help appreciated.

    TIA :-)
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Help to modify formula so that it only searches for whole string

    I am a bit confused. rather than showing us a non-working formula, please tell us (manually calculated) a few examples of what you EXPECT to see.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Help to modify formula so that it only searches for whole string

    Maybe
    =TEXTJOIN("|",,IF(ISNUMBER(SEARCH("|"&Categories!$A$2:$A$73&"|","|"&A2&"|")),Categories!$B$2:$B$73,""))

    CSE entered

  4. #4
    Registered User
    Join Date
    11-09-2009
    Location
    Shropshire UK
    MS-Off Ver
    Excel 365
    Posts
    38

    Re: Help to modify formula so that it only searches for whole string

    Quote Originally Posted by Glenn Kennedy View Post
    I am a bit confused. rather than showing us a non-working formula, please tell us (manually calculated) a few examples of what you EXPECT to see.
    Sorry, it always seems clearer to the person who writes it!

    So on the revised speadsheet, sheet 'Expected Outcome' shows in column B what I want as the outcome of the formula.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-09-2009
    Location
    Shropshire UK
    MS-Off Ver
    Excel 365
    Posts
    38

    Re: Help to modify formula so that it only searches for whole string

    Quote Originally Posted by Fluff13 View Post
    Maybe
    =TEXTJOIN("|",,IF(ISNUMBER(SEARCH("|"&Categories!$A$2:$A$73&"|","|"&A2&"|")),Categories!$B$2:$B$73,""))

    CSE entered
    Thanks Fluff13, that seems to work perfectly :-)

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Help to modify formula so that it only searches for whole string

    You're welcome & thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 09-04-2013, 02:09 PM
  2. Replies: 14
    Last Post: 07-29-2013, 05:41 PM
  3. [SOLVED] VBA Search for string, modify and re-enter
    By passman86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2013, 10:46 AM
  4. String Searches
    By cpadude in forum Excel General
    Replies: 1
    Last Post: 01-25-2008, 09:18 PM
  5. Function that searches cell for string?
    By IanMcGreene in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-09-2006, 06:54 PM
  6. Getting valid web searches and avoiding sites that contaminate web searches
    By David McRitchie in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-12-2006, 10:10 PM
  7. Need help -- a Macro that searches for string in a cell range?
    By graphicGuy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2006, 01:00 PM

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