+ Reply to Thread
Results 1 to 3 of 3

Is there a formula or way to extract a specific string format from a cell?

  1. #1
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Is there a formula or way to extract a specific string format from a cell?

    So i have a column in a report that for the most part has a structured string value but on certain rows and records, that string does not exist.. so when i apply a LEFT formula on the new column to extract that string, i get alot of chopped up values and rather have the cell empty..

    So i have this in our raw data column with a value structures like this:

    STR4552 -Alexandria LA. (Alexandria,LA)
    STR4537 - Lake Charles LA (Lake Charles, LA)
    Elizabethtown
    USA

    is this a safe formula to use to accomplish what im trying to do? my initial testing seems to look correct, im just curious if this is the best option. in the above sample data, i only want the new column to contain the STR value and if it doesn exist, then i want the cell empty.

    =IF(ISNUMBER(SEARCH("STR",D2)),LEFT(D2,6),"")
    If you find the suggestion or solution helpful, please consider adding reputation to the post.

  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 2406
    Posts
    44,662

    Re: Is there a formula or way to extract a specific string format from a cell?

    It all depends on what variations exist in your data. BtW, you probably meant:

    =IF(ISNUMBER(SEARCH("STR",A2)),LEFT(A2,7),"")

    Safe enough... providing that STR can not occur elsewhere/earlier in the string. "Strictly speaking"... will return "Strictl" and "Astrid's house STR4552 -Alexandria LA. (Alexandria,LA)" will not return what you want.

    Street, strip, strange, etc, all have the potential to be a problem... but it's all down to the raw data. Does it ALWAYS start with STR if STR is present?

    A few more representative samples (in an Excel file) would help, if needed.
    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

  3. #3
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Is there a formula or way to extract a specific string format from a cell?

    So yes if STR is in the cell, it will always be the beginning of that cell.. so MAYBE if there is a way to check if STR is the first part of the cell, then that would help cut down on those other occurances?
    Last edited by AliGW; 05-12-2022 at 03:06 PM. Reason: PLEASE don't quote unnecessarily!

+ 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. [SOLVED] A Formula Which Extract The String Between The Nth Occurances Of Specific Characters
    By zanshin777 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-25-2021, 03:58 PM
  2. [SOLVED] Extract specific string from adjacent cell
    By craigbrown70 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2020, 07:00 PM
  3. Extract Specific Text within Cell (and String) Occurring Variably
    By Cond.SILVERFOX in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2018, 04:33 PM
  4. [SOLVED] Formula to Extract Specific Characters from a String
    By BONCH in forum Excel General
    Replies: 5
    Last Post: 06-27-2017, 10:45 PM
  5. Extract/return specific text from cell/string
    By JE2BD in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2015, 05:32 PM
  6. Extract string based on specific string
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-15-2014, 12:16 AM
  7. [SOLVED] Split String in 3 Blocks of #s, Extract each Block to copy on specific Cell
    By david gonzalez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 12:14 AM

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