+ Reply to Thread
Results 1 to 6 of 6

Extract text between two commas

  1. #1
    Registered User
    Join Date
    12-12-2014
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    43

    Extract text between two commas

    Hi all,

    I'm trying to extract a particular text between two commas and am looking for some help. I have an address in A1 which I'm hoping to extract 'XYZ' from and show 'XYZ' in A2.

    A1: 123 ABC Street, XYZ, NY, 12345
    A2: XYZ

    I've used the formula below, but it's showing cell A2 as ' XYZ'. Any ideas how to extract it without the space before the text?

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Turkey
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Extract text between two commas

    Try this

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Extract text between two commas

    =TRIM(your formula) will remove the space.
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

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

    Re: Extract text between two commas

    Your formula works if you add the TRIM function to the beginning:

    TRIM(...)

    This one is a few keystrokes shorter:

    =TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",100)),100,100))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    12-12-2014
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    43

    Re: Extract text between two commas

    Awesome, thanks a lot guys!

  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: Extract text between two commas

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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] Return text between last two commas
    By huwtre in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-18-2014, 07:10 AM
  2. Replies: 5
    Last Post: 01-17-2014, 05:56 PM
  3. Replies: 4
    Last Post: 06-21-2012, 08:17 PM
  4. Replies: 3
    Last Post: 05-30-2012, 04:28 PM
  5. [SOLVED] How to save text as CSV which also contains commas?
    By V.R. in forum Excel General
    Replies: 3
    Last Post: 04-10-2006, 08:10 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