+ Reply to Thread
Results 1 to 7 of 7

Extract two numbers from text if two numbers exist

  1. #1
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Extract two numbers from text if two numbers exist

    Hi, I have a column with text that begins with

    R1 some text
    R2 some text
    etc
    R10 some text
    R11 some text

    How can I extract the first number (1,2) but also the second if there is a second (10,11) so the output would be:

    1
    2
    10
    11

    I tired =RIGHT(LEFT(A2,2),1) but it doesn't give me 10 and 11 (only 1)

  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,869

    Re: Extract two numbers from text if two numbers exist

    Try this instead:

    =MID(A2,2,(FIND(" ",A2)-2))
    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
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    485

    Re: Extract two numbers from text if two numbers exist

    Or this:

    =--MID(A2,2,2)

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Extract two numbers from text if two numbers exist

    Or just this, IF your format will always be the same...
    =--MID(K2,2,2)
    To catch the cells with no numbers...
    =IFERROR(--MID(K2,2,2),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Extract two numbers from text if two numbers exist

    perfect. Thanks!

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract two numbers from text if two numbers exist

    or this one, but you will need add-in for Excel 2010 : PowerQuery
    Doesn't matter how long is your number
    source Numbers
    R1 some text 1
    R2 some text 2
    R5 some text 5
    R10 some text 10
    R11 some text 11
    R100 some text 100
    R1000 sometext 1000
    R10000 some text 10000
    Attached Files Attached Files
    Last edited by sandy666; 10-02-2017 at 02:50 AM.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Extract two numbers from text if two numbers exist

    Happy to help

+ 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. Extract numbers from Text
    By suhabthan in forum Excel General
    Replies: 6
    Last Post: 01-28-2014, 08:39 AM
  2. [SOLVED] Extract Certain Numbers from Text
    By tgallag1 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-03-2013, 08:17 AM
  3. Extract numbers before text
    By OptionTrader in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-20-2009, 01:03 PM
  4. Extract numbers from text
    By faris_dxb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-10-2009, 12:58 PM
  5. [SOLVED] Extract numbers from text
    By Therese in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2006, 08:45 PM
  6. Extract numbers from cell with Text and Numbers
    By wiredwrx in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-18-2006, 06:00 PM
  7. [SOLVED] How do I extract numbers from a cell with both text and numbers?
    By SHANNON in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-01-2005, 10:35 PM
  8. [SOLVED] extract numbers from cell containing text & numbers
    By [email protected] in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-14-2005, 03: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