+ Reply to Thread
Results 1 to 5 of 5

Selecting numbers from within a cell

  1. #1
    Registered User
    Join Date
    01-17-2015
    Location
    Tacoma, WA
    MS-Off Ver
    2013
    Posts
    2

    Selecting numbers from within a cell

    I have a column of cells, each of which contains five numbers separated by spaces, e.g., 11 8 10 5 8. Is it possible to write a formula that would select either the first number, "11" or the second number "8"?

    Thank you for any help.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,868

    Re: Selecting numbers from within a cell

    The first number is given by:

    =--LEFT(A1,FIND(" ",A1)-1)

    You can get the second number with this:

    =--MID(A1,FIND(" ",A1)+1,2)

    assuming your numbers are no more than two digits long.

    Hope this helps.

    Pete

  3. #3
    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,969

    Re: Selecting numbers from within a cell

    Hi, welcome to the forum

    Try this...
    A
    B
    C
    1
    11 8 10 5 8
    5
    8

    A1=youer "number"
    B1=the number you want to find
    C1=--IF(B1=1,LEFT(A1,2),MID(A1,FIND("xx",SUBSTITUTE(A1," ","xx",B1-1),1)+1,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

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Selecting numbers from within a cell

    For similar layout shown by FDibbins

    change value in B1

    =--TRIM(MID(SUBSTITUTE(" "&A1," ",REPT(" ",25)),25*B1,25))
    Last edited by AlKey; 01-17-2015 at 05:32 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    01-17-2015
    Location
    Tacoma, WA
    MS-Off Ver
    2013
    Posts
    2

    Re: Selecting numbers from within a cell

    Pete's solution works best for me. 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. Replies: 6
    Last Post: 02-27-2014, 07:04 PM
  2. Replies: 4
    Last Post: 06-07-2013, 02:01 PM
  3. Selecting numbers from a table according to value
    By abrunstad in forum Excel General
    Replies: 1
    Last Post: 02-12-2009, 02:16 PM
  4. Program to randomly selecting numbers from a group of numbers
    By flexalong in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2008, 04:22 AM
  5. Selecting a number in a cell with multiple numbers...
    By STROBE in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-15-2008, 09:02 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