+ Reply to Thread
Results 1 to 10 of 10

Split a number

  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    Manchester, England
    MS-Off Ver
    2010
    Posts
    7

    Split a number

    I have a number in cell a1, that consists of 7032 two digit numbers, followed by a comma e.g. 01, 02, 03, 11, 91, 65, 45, 62, 83, 79 etc.

    I need to split that number into groups of 8 , in one row (column A to H) so A2 = 01, B2 = 02, C2 = 03, D2 = 11, E2 = 91, F2 = 65, G2 = 45, H2 = 62, A3= 83, B3 = 79 etc (commas only appear here to show grouping, it wouldnt be in the final cells).

    I will end up with 879 rows each with 8 number on.

    Anyone got any idea how I can systematically do this?

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Split a number

    Hi,

    I have attached a workbook showing an example of what I think you want. My cell A1 only contains 16 values separated by ", " (note the space after the comma).

    You should be able to copy this code into your workbook and make it work using a CommandButton on the active worksheet.

    I hope this helps

    Let me know if you need help integrating this into your workbook. I can also help you understand the code if you would like.
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Split a number

    Actually, use this attachment instead...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-28-2014
    Location
    Manchester, England
    MS-Off Ver
    2010
    Posts
    7

    Re: Split a number

    Thanks for the rapid response ajryan88.

    However, all the code appears to do is copy the number to row two and then nothing. Now i've just noticed that some of the numbers are actually 6d, 6f, 6c. Is this why the code doesnt work (it works perfectly in your example)?

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Split a number

    Maybe:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-28-2014
    Location
    Manchester, England
    MS-Off Ver
    2010
    Posts
    7

    Re: Split a number

    John H. Davis, thanks very much that worked perfectly.

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Split a number

    My code won't work if your numbers are delimited differently. Try replacing
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    in your workbook. This will work if your numbers are separated by a comma only (as opposed to a comma followed by a space like I originally assumed).

    I hope this helps

  8. #8
    Registered User
    Join Date
    07-28-2014
    Location
    Manchester, England
    MS-Off Ver
    2010
    Posts
    7

    Re: Split a number

    ajryan thanks very much, it must have been the extra space that was killing it as making the little change made it work perfectly.

    Brilliant help, two solutions, both work, couldnt be happier, thank you both.

  9. #9
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Split a number

    You're welcome

    Please don't forget to click on the * next to the posts of the people who have helped you, just to say thanks

    Have a great day

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Split a number

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. Split up number
    By rizmomin in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 02-16-2014, 01:32 PM
  2. Replies: 6
    Last Post: 11-26-2013, 05:21 PM
  3. Split Number To Digits
    By sujittalukder in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-02-2012, 08:52 PM
  4. Excel 2007 : Trying to split number into ranges
    By daveydet in forum Excel General
    Replies: 2
    Last Post: 11-02-2010, 01:54 PM
  5. Split cell before number?
    By majahops in forum Excel General
    Replies: 2
    Last Post: 02-09-2008, 08:08 PM

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