+ Reply to Thread
Results 1 to 14 of 14

How to split/grab number from string?

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Talking How to split/grab number from string?

    hey, how can I grab the middle number in this number string 01:30.5 (A1)

    cell should = 30 (B1)

    with the small and easy Excel-Formula possible?
    Last edited by QuantEdge; 08-18-2017 at 12:03 PM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to split/grab number from string?

    =MOD($A1,SEARCH(":",$A1,1)+1,2)

    but probably the question will be more complex.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: How to split/grab number from string?

    thx oeldere.. but it does work! please give example sheet.

    it states "You've entered too many arguments for this function."
    Last edited by QuantEdge; 08-18-2017 at 12:17 PM.

  4. #4
    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
    81,019

    Re: How to split/grab number from string?

    It should be this:

    =MID($A1,SEARCH(":",$A1,1)+1,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.

  5. #5
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: How to split/grab number from string?

    still does work! please share sheet

    my sheet attached
    Attached Files Attached Files
    Last edited by QuantEdge; 08-18-2017 at 12:40 PM.

  6. #6
    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
    81,019

    Re: How to split/grab number from string?

    Try this:

    =SECOND(A1)

    Make sure that B1 is set to general formatting.

    Please stop asking people to share their sheets - it is you who should be doing that, as it is your data that is causing the issues.

  7. #7
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: How to split/grab number from string?

    AliGW, sorry about that but still does not work please check out my attached sheet!
    Attached Files Attached Files
    Last edited by QuantEdge; 08-18-2017 at 12:47 PM.

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,891

    Re: How to split/grab number from string?

    Try this then.

    =INT(A1*24*60*60)

    Oh wait, this works with your example but not when there's min/hour portion.

    Give me a sec.

    Edit: this ought to do it.
    =MOD(INT(A1*24*60*60),60)
    Last edited by CK76; 08-18-2017 at 01:07 PM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to split/grab number from string?

    =MID($A1,SEARCH(":",$A1,1)+1,2)
    yes translation error

    QuantEdge

    thx oeldere.. but it does work!
    That is strange, since in your added file it does NOT work.

    But if it work, then the question is solved?
    Last edited by oeldere; 08-18-2017 at 01:26 PM.

  10. #10
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: How to split/grab number from string?

    thx oeldere, that works nicely

    now is there any way to grab the first number on the left?

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,832

    Re: How to split/grab number from string?

    I might suggest that the OP is a little misleading. The OP refers to the cell as a "number string" when the cell actually contains a time serial number (review this to see how Excel stores date/time values: http://www.cpearson.com/Excel/datetime.htm ).

    Here's how I would probably do it:

    1) Extract the minutes value first. This is easily accomplished using the MINUTE() function https://support.office.com/en-us/art...d-a84801a60589 =MINUTE(A2)
    2) AliGW's SECOND() function would work for the seconds value, if Microsoft's programmers had programmed the function to handle fractional seconds. However, it seems to be programmed to return only integer seconds, so we need to do it differently. Recognizing that the number in column A is just a fraction of a day, multiply by 24*3600 to convert to total seconds, then subtract off the number of seconds taken up by the minute's number. =A2*24*3600-B2*60 (assuming you put =MINUTES(A2) in B2).
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to split/grab number from string?

    =left(a1,2)

  13. #13
    Forum Contributor
    Join Date
    08-18-2017
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: How to split/grab number from string?

    thx guy's got it working now... I will * both of you... you save me a day of clicking...

  14. #14
    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
    81,019

    Re: How to split/grab number from string?

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Search for a string, grab the numbers from adjoining column
    By noobis in forum Excel - New Users/Basics
    Replies: 15
    Last Post: 03-28-2016, 04:21 PM
  2. [SOLVED] Split String at every "/" then put split string results into a multiline textbox.
    By Andrew Andromeda in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2015, 01:49 AM
  3. [SOLVED] macro to split text/number string
    By wbi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2013, 10:34 PM
  4. Grab specific string from one cell and post it in another.
    By Lazarus74 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-14-2012, 02:55 AM
  5. Can excels Split() function split a string up at multiple spots?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2011, 02:36 PM
  6. Function to grab info in middle of string
    By DKY in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2008, 10:31 AM
  7. How do I grab the date from a text string?
    By [email protected] in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-06-2006, 03:00 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