+ Reply to Thread
Results 1 to 5 of 5

Extract text from cell data

  1. #1
    Registered User
    Join Date
    06-29-2015
    Location
    Denver, CO - USA
    MS-Off Ver
    Office 2013
    Posts
    6

    Extract text from cell data

    Good morning,

    I was wondering if there is a function or formula that can pull text from a cell string in a specific format

    EXAMPLE:

    CP-6921
    CP-8811
    CP-6921-C-K9
    CP-8811-K9 V04
    PID VID CP8811.K9 V04
    PID VID: CP-6921-K9 = V02

    I would like to pull the data from the above into the following format

    CP-0000

    Any insight would be appreciated

    Thanks!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,914

    Re: Extract text from cell data

    Does what you want to extract always start with CP? If not, provide a more representative sample of data in a workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    04-19-2015
    Location
    pakistan
    MS-Off Ver
    2013
    Posts
    335

    Re: Extract text from cell data

    use below in B1

    =SUBSTITUTE(MID(A1,FIND("CP",A1),7),".","")

    or want like CP-0000, if dash exist or not than

    ="CP-"&MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),4)

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Extract text from cell data

    Assume that data is in Column A
    Please try B1
    ="CP-"&MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&1/17)),4)

  5. #5
    Valued Forum Contributor jtakw's Avatar
    Join Date
    05-05-2018
    Location
    CA, USA
    MS-Off Ver
    2016
    Posts
    668

    Re: Extract text from cell data

    Hi,

    If what you want extracted Always starts with "CP" and you want the extracted results to be in "CP-0000" format as you described in OP...

    This would work regardless of Where within the Text string is the value you want extracted, or if you have Other numbers preceding the value you want extracted:

    Excel 2016 (Windows) 64 bit
    A
    B
    1
    CP-6921 CP-6921
    2
    CP-8811 CP-8811
    3
    CP-6921-C-K9 CP-6921
    4
    CP-8811-K9 V04 CP-8811
    5
    PID VID CD8811.K9 V04
    6
    PID VID CP8811.K9 V04 CP-8811
    7
    PID VID: CP-6921-K9 = V02 CP-6921
    8
    C-K9-CP-6921 V04 CP-6921
    9
    K9 = V02 PID VID: CP6921 CP-6921
    Sheet: Sheet99

    Excel 2016 (Windows) 64 bit
    B
    1
    =IFERROR(REPLACE(MID(SUBSTITUTE(A1,"-",""),SEARCH("CP",SUBSTITUTE(A1,"-","")),6),3,,"-"),"")
    Sheet: Sheet99

    Formula copied down.

+ 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] Extract data from cell with variabel text length
    By Marijke in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-07-2018, 04:41 PM
  2. How to extract data based on cell or text color
    By johnwick22 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2017, 05:16 PM
  3. Extract data by cell or text color
    By johnwick22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-02-2017, 05:14 PM
  4. Find specific text from cell and extract the data from the same row
    By roybong in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2014, 09:57 AM
  5. [SOLVED] How to extract text data from one cell based on the date on another cell?
    By Prabhu.nanda in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-11-2013, 08:46 AM
  6. Extract multiple data from a text found in a cell
    By nagsharan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-16-2013, 03:36 PM
  7. Replies: 12
    Last Post: 09-15-2012, 10:20 PM

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