+ Reply to Thread
Results 1 to 9 of 9

Search column for multiple strings

  1. #1
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Search column for multiple strings

    I'd like to add a column in my spreadsheet that will search another column of data for various strings, reporting either "Present" (if any one of the strings is present) or "ABSENT" (if none are). Specifically, the column to be searched will have address information (e.g., "123 Oak Drive"). I'd like to use a formula to search each cell in the address column for various address components (e.g., "Road," "Drive," "Avenue," "Boulevard"). I want the search to not be case-specific, so I'm guessing it will involve the "SEARCH()" command. As my thinking goes, the formula would involve both ISERROR, SEARCH, and OR (to indicate more than one search term), but I haven't been able to figure out anything that works.

    Here's a little example of what I'd like the formula to do (assuming the search formula in the "Check" column includes the terms "Drive," "Avenue," and "Boulevard"):

    Address Check
    123 Oak Drive Present
    25 Wesley Avenue Present
    64 1st Boulevard Present
    65 Chalmers ABSENT

    Any help you could provide would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Search column for multiple strings

    Hi there,

    There's probably a more efficient way, but this will do the trick:

    =IF(ISNUMBER(FIND("Avenue",A2))+ISNUMBER(FIND("Boulevard",A2))+ISNUMBER(FIND("Drive",A2))+ISNUMBER(FIND("Road",A2))=0,"ABSENT","Present")

    Just change the cell reference to suit and fill down as required.

    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Search column for multiple strings

    Thanks! This is really close! The only problem is that "FIND" is case sensitive, so if an address has "avenue" instead of "Avenue," it still shows up as "ABSENT." Know how to make this insensitive to case?

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Search column for multiple strings

    Know how to make this insensitive to case
    Yes, use the SEARCH function instead, i.e.

    =IF(ISNUMBER(SEARCH("Avenue",A2))+ISNUMBER(SEARCH("Boulevard",A2))+ISNUMBER(SEARCH("Drive",A2))+ISNUMBER(SEARCH("Road",A2))=0,"ABSENT","Present")

    Regards,

    Robert

  5. #5
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Search column for multiple strings

    Perfect! Many thanks!

  6. #6
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Search column for multiple strings

    I wonder, though, is there some way to just list a bunch of search terms in a single column (e.g., column F) and have the program search each cell of a different column for all terms that appear in the range F1:F25? The solution you offered certainly works, but I'm wondering if there's an easier way that just involves listing search terms rather than adding all the additional text to a single formula.

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Search column for multiple strings

    There probably is, but via a formula solution I'm not too sure I'm afraid. You only need to change the first formula and copy it down which isn't that much more than you're suggesting.

  8. #8
    Registered User
    Join Date
    06-11-2011
    Location
    Carrboro, NC
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Search column for multiple strings

    Yeah, that'll work. Thanks again!

  9. #9
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Search column for multiple strings

    You're welcome

+ 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