+ Reply to Thread
Results 1 to 4 of 4

Code to Extract certain text from a string

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    2

    Code to Extract certain text from a string

    Hi All,

    I have a string of text and within it is a certain ID that is consistently formatted in the same way, but the location within the text is not always the same.
    Format is: 1-XXXXXX

    I have created a formula that extracts the ID about the majority of the time, but does anybody know of a way that I could write a code to find 1-XXXXXX within the text string and just extract portion?

    This is probably confusing so I've included an example and an excel sheet to show.

    Thanks!

    Formula currently used:
    =IF((LEFT(RIGHT(LEFT($D2,34),8),1)="1"),RIGHT(LEFT($D2,34),8),"N/A")
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Code to Extract certain text from a string

    Hi Bcorm,
    try it
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Code to Extract certain text from a string

    Try this regular formula, copied down as far as you need:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    09-12-2012
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Code to Extract certain text from a string

    These were exactly what I was looking for, Thank you!

+ 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] Find and extract text string from within another text string
    By huy_le in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-12-2013, 03:22 PM
  2. Find and extract text string from within another text string
    By huy_le in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2013, 09:01 PM
  3. [SOLVED] How to Extract A Number from String if Text within the String Equals XYZ
    By tyrsfury in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-15-2012, 03:30 PM
  4. [SOLVED] extract text string when you only know the last three letters of that string
    By alison0edwards in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-12-2012, 01:20 PM
  5. Extract small string of text from larger string
    By mark_jam3s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2010, 05:36 AM

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