+ Reply to Thread
Results 1 to 6 of 6

Finding Start Position of string in list of strings

  1. #1
    Registered User
    Join Date
    12-15-2006
    Posts
    64

    Finding Start Position of string in list of strings

    I need to strip off the PL, DR, ST, RD, CIR, LN, etc. from data in address fields.

    Is there a function that would allow me to identify the starting positon of any of these strings if they are found in the contents of a cell.

    I've tried things like:

    =FIND(OR(" PL"," DR"," RD"),a1,1) and some other imaginative functions but without success.

    LongFisher

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    You can use nested SUBSTITUTE functions

    Please Login or Register  to view this content.
    etc.
    Martin

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    The SEARCH (case-insensitive) and FIND (case-sensitive) functions aren't meant to look for multiple strings.

    Even if you did check for each string separately, you could get incorrect results occasionally. For example, if you're searching for " DR", and cell A1 contained "155 DRISCOLL DR", the result of a SEARCH or FIND function would be 4 ("155 DRISCOLL DR) not 13 ("155 DRISCOLL DR").

    MRice provided a substitute formula you could use to remove the "DR", "LN", "CIR", etc., however this could be very destructive as well for the same reason. "155 DRISCOLL DR" would end up becoming "155 ISCOLL" since the substitute function would remove any and all instances of "DR".

    If you replaced "RD" with "", then "12 CARDINAL RD" would become "12 CAINAL". And what if you replaced " ST" (space in front of ST, trying to be smart) with nothing, think of how many streets start with "### ST___".

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    You can improve the safety of the substitute and find functions by adding leading and trailing spaces.

    e.g.

    replacing " RD" with " " will change "STAFFORD RD" to "STAFFORD "

  5. #5
    Registered User
    Join Date
    12-15-2006
    Posts
    64

    Nested Substitute & Added Space Worked Great!

    Thanks to all who helped.

    LongFisher

  6. #6
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    You're welcome. Glad we could help you out.

+ 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