+ Reply to Thread
Results 1 to 9 of 9

Seeking Formula to separate cells that contain specific terms

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    LA
    MS-Off Ver
    Excel For Mac 2011
    Posts
    99

    Seeking Formula to separate cells that contain specific terms

    I have thousands of data entries (each in their own row, all in one column) and need to separate the basic info. In the example below, say you want to isolate the Town names by entering a formula that can produce a TRUE or FALSE result. Is there a way to use the FIND function and a pool of terms to isolate cells that contain excess data (i.e.- produce a FALSE result for cells containing any words from a term pool like : "Police, Park, Power, Water, Community, Bakery, Grocery, Field, Garden, Post Office, School" etc... ) ?

    Pic of sample spreadsheet with desired result:
    Screen Shot 2014-03-18 at 3.14.09 AM.png


    example as text:
    A2 = Springfield
    A3 = Springfield Police Department
    A4 = Springfield Community College
    A5 = Springfield Park Of Recreation
    A6 = Des Moines
    A7 = Des Moines Power & Water Company
    A8 = Des Moines Sunrise Bakery
    A9 = Des Moines Post Office
    A10 = Des Moines Grocery Store
    A11 = Lancaster
    A12 = Lancaster Baseball Field
    A13 = Lancaster Botanical Gardens
    Last edited by syncguy; 03-18-2014 at 06:33 AM. Reason: ..in-case you can't see the pic..

  2. #2
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Seeking Formula to separate cells that contain specific terms

    Hi
    Solution depends on presented data actually. Formula below presents desired results for those informations
    =IF((LEN(TRIM(A1))-IFERROR(LEN(SUBSTITUTE(TRIM(A1)," ","")),LEN(TRIM(A1))))>1,FALSE,TRUE)
    Appreciate the help? CLICK *

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Seeking Formula to separate cells that contain specific terms

    Here are the results I get:

    Data Range
    A
    B
    C
    D
    1
    ------
    2
    Springfield
    TRUE
    Police
    3
    Springfield Police Department
    FALSE
    Park
    4
    Springfield Community College
    FALSE
    Power
    5
    Springfield Park Of Recreation
    FALSE
    Water
    6
    Des Moines
    TRUE
    Community
    7
    Des Moines Power & Water Company
    FALSE
    Bakery
    8
    Des Moines Sunrise Bakery
    FALSE
    Grocery
    9
    Des Moines Post Office
    FALSE
    Field
    10
    Des Moines Grocery Store
    FALSE
    Garden
    11
    Lancaster
    TRUE
    Post
    12
    Lancaster Baseball Field
    FALSE
    Office
    13
    Lancaster Botanical Gardens
    TRUE
    School


    In A13 the word "gardens" is not an exact match (spelling-wise) with the keyword "garden".

    The words have to be exact matches of the keywords. If there are variations like that above then you need to include those variations in the keyword list and they have to be listed in a specific order. Like this:

    Data Range
    A
    B
    C
    D
    1
    ------
    2
    Springfield
    TRUE
    Police
    3
    Springfield Police Department
    FALSE
    Park
    4
    Springfield Community College
    FALSE
    Power
    5
    Springfield Park Of Recreation
    FALSE
    Water
    6
    Des Moines
    TRUE
    Community
    7
    Des Moines Power & Water Company
    FALSE
    Bakery
    8
    Des Moines Sunrise Bakery
    FALSE
    Grocery
    9
    Des Moines Post Office
    FALSE
    Field
    10
    Des Moines Grocery Store
    FALSE
    Gardens
    11
    Lancaster
    TRUE
    Garden
    12
    Lancaster Baseball Field
    FALSE
    Post
    13
    Lancaster Botanical Gardens
    FALSE
    Office
    14
    School


    This formula entered in B2 and copied down:

    =ISERROR(LOOKUP(1E+100,SEARCH(" "&D$2:D$14&" "," "&A2&" ")))
    Last edited by Tony Valko; 03-18-2014 at 07:39 AM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Seeking Formula to separate cells that contain specific terms

    Another solution.
    =IF(COUNTIF(A:A,"*"&TRIM(A1)&"*")>1,TRUE,FALSE)
    While testing if it gives wrong result then test your text (Des Moines and lancaster)

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Seeking Formula to separate cells that contain specific terms

    Or this:

    =LEN(A2)-LEN(SUBSTITUTE(A2," ",""))<=1


    A
    B
    1
    Data
    2
    Springfield
    TRUE
    3
    Springfield Police Department
    FALSE
    4
    Springfield Community College
    FALSE
    5
    Springfield Park Of Recreation
    FALSE
    6
    Des Moines
    TRUE
    7
    Des Moines Power & Water Company
    FALSE
    8
    Des Moines Sunrise Bakery
    FALSE
    9
    Des Moines Post Office
    FALSE
    10
    Des Moines Grocery Store
    FALSE
    11
    Lancaster
    TRUE
    12
    Lancaster Baseball Field
    FALSE
    13
    Lancaster Botanical Gardens
    FALSE
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Seeking Formula to separate cells that contain specific terms

    I must not understand what the OP wants.

    My suggestion is nothing like the other suggestions.

  7. #7
    Registered User
    Join Date
    02-07-2012
    Location
    LA
    MS-Off Ver
    Excel For Mac 2011
    Posts
    99

    Re: Seeking Formula to separate cells that contain specific terms

    Thank you everyone! AZ-XL's formula worked best.. at least when I applied it to the bulk data. Still kind of baffled as to how these work with out the pool of terms that I was mentioning.. ? Amazing stuff



    Quote Originally Posted by AZ-XL View Post
    Another solution.
    =IF(COUNTIF(A:A,"*"&TRIM(A1)&"*")>1,TRUE,FALSE)
    While testing if it gives wrong result then test your text (Des Moines and lancaster)

  8. #8
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Seeking Formula to separate cells that contain specific terms

    You are welcome. And thank you for feedback.

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Seeking Formula to separate cells that contain specific terms

    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: 1
    Last Post: 06-01-2011, 12:24 PM
  2. Separate string and place into specific cells
    By genestoy in forum Excel Programming / VBA / Macros
    Replies: 35
    Last Post: 09-02-2010, 02:34 PM
  3. Compare Specific Cells From Three Separate Worksheets
    By Outlaw 13 in forum Excel General
    Replies: 2
    Last Post: 03-27-2009, 11:07 AM
  4. Seeking Information Formula for specific logic
    By sweeetk in forum Excel General
    Replies: 1
    Last Post: 11-21-2008, 05:57 PM
  5. Help Printing Rows with specific terms.
    By DrOct in forum Excel - New Users/Basics
    Replies: 13
    Last Post: 06-24-2008, 03:36 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