+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : How to search text string within a column and return search value in adjacent column

  1. #1
    Registered User
    Join Date
    07-26-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    How to search text string within a column and return search value in adjacent column

    Hi

    I'm trying to do something I thought would be quite simple in excel, yet it's causing me problems getting it to work.

    I have multiple words (say 5) that i know are contained in a column of data (shop1, shop2, shop3 in my example). what i want to do is say "if cell A1 contains shop1, shop2 or shop3, output whichever one is found in cell B1". only one hit will be in a cell (i.e. shop1 and shop2 won't be in the same cell).

    can anyone help? this is driving me nuts

    See example below.

    Column A
    shop1, 23 smith st
    234 forfar st, shop 2
    shop1 42, bob street

    Column B
    return the search value if found.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,997

    Re: How to search text string within a column and return search value in adjacent col

    See if this gives you what you want:

    =IF(LEN(A1)-LEN(SUBSTITUTE(A1,"shop",""))=0,"",MID(A1,FIND("shop",A1),6))


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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