+ Reply to Thread
Results 1 to 27 of 27

Split a Sequence of Numbers

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Split a Sequence of Numbers

    I have a column of numbers of different lengths that I need split into 2 columns of the first and last numbers.

    It is a bit of a long shot but would be good to know if this is possible.

    I tried putting the numbers into columns but I couldn't format them when uploaded.

    Sheet attached.

    Thanks in advance Doug

    Sequence First Last
    111 1 1
    21112 2 2
    3211123 3 3
    432111234 4 4
    54321112345 5 5
    Last edited by dougkpga; 01-07-2024 at 07:49 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,556

    Re: Split a Sequence of Numbers

    Clear any expected results and use:
    Formula: copy to clipboard
    =LET(a,A2:A6,HSTACK(LEFT(a,1),RIGHT(a,1)))
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,556

    Re: Split a Sequence of Numbers

    Better:
    Formula: copy to clipboard
    =LET(a,A2:A6,HSTACK(LEFT(a,1)+0,RIGHT(a,1)+0))

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    Or:

    =HSTACK(--LEFT(A2:A6,1),--RIGHT(A2:A6,1))
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    First - I am amazed at what Excel can do.

    Second - I am more amazed that you guys know Excel so well that you could find these formulas.

    Thank you so much.

  6. #6
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    I guess you have to deal with newbies (I'm not really) but maybe a dummy but I pasted Trevor 2 and Ali 1 into columns B and C on my sheet and I get #NAME?

    So my obvious naive question is where do I paste please?

    Or even send my sheet back with the alteration?
    Last edited by dougkpga; 01-07-2024 at 09:12 AM. Reason: additional question

  7. #7
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    79

    Re: Split a Sequence of Numbers

    Try

    =HSTACK(LEFT(A2:A6),RIGHT(A2:A6))
    Last edited by Tommy90; 01-07-2024 at 09:35 AM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    Quote Originally Posted by Tommy90 View Post
    Try

    =HSTACK(LEFT(A2:A6),RIGHT(A2:A6))
    That would return text. You'd need:

    =HSTACK(--LEFT(A2:A6),--RIGHT(A2:A6))

    to return numbers.

  9. #9
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    79

    Re: Split a Sequence of Numbers

    Quote Originally Posted by AliGW View Post
    That would return text. You'd need:

    =HSTACK(--LEFT(A2:A6),--RIGHT(A2:A6))

    to return numbers.
    For numbers:

    =--HSTACK(LEFT(A2:A6),RIGHT(A2:A6))

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    So my obvious naive question is where do I paste please?
    Wherever you want as long as the ranges define the area where your data is:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    C
    1
    111
    1
    1
    2
    21112
    2
    2
    3
    3211123
    3
    3
    4
    432111234
    4
    4
    5
    54321112345
    5
    5
    Sheet: Sheet1

    Attach a workbook if you can't work it out.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    #NAME?
    Oh, dear! Your profile says that you are using Office 365, but that suggests you're not. Anything to declare???

  12. #12
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    I have no idea what version of excel I am using,

  13. #13
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    I dont know what I am doing wrong - it looks straightforward

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    Attach a workbook - we can't troubleshoot "I don't know what I'm doing wrong". Are you sure you're using 365??? If so, is it fully up-to-date? If you're not on 365, change your forum profile, please.

    For pre-265, you need two formulae:

    --LEFT(A2,1)

    and:

    --RIGHT(A2,1)

    Copy both down.
    Last edited by AliGW; 01-07-2024 at 09:30 AM.

  15. #15
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    Here is the screenshot.....



    Attachment 854876

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    Screenshots are of little use, but this one reveals that your forum profile is wrong - you're not using 365.

    See post #12.

    In future, if we ask for a workbook, provide a workbook, not a picture of a workbook!

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The three most recent Excel products are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

  17. #17
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    Is this the right version?


    Attachment 854877

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    No - it says Office 2021 top left. Please update your forum profile. Use the formulae in post #12.
    Attached Files Attached Files
    Last edited by AliGW; 01-07-2024 at 09:36 AM. Reason: Workbook added.

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    Tommy - either that or what I said, but it's moot - the OP does not have HSTACK.

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    @Doug: see below (change MS 365 for Apps to Excel 2021).
    Attached Images Attached Images
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    79

    Re: Split a Sequence of Numbers

    I get #NAME....
    Now I know.

  22. #22
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    Okay I updated from your post about going to file - account

    It is Microsoft Office Professional Plus 2021.

    I must have upgraded since my last visit.

    I also changed it in the profile from that post but thanks for the pic.

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    You have DOWNGRADED, as your ‘new’ version doesn’t have the new 365 functions.

    Use the alternatives in the workbook I provided - columns D and E.

    Glad to have helped.

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

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  24. #24
    Forum Contributor
    Join Date
    04-15-2016
    Location
    Gold Coast Australia
    MS-Off Ver
    Microsoft Office Professional Plus 2021
    Posts
    147

    Re: Split a Sequence of Numbers

    Wow, learnt a lot there. Especially about different versions.

    Formula in Post #12 worked perfectly.

    Sorry for the extra work.

    Thanks again.

  25. #25
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,556

    Re: Split a Sequence of Numbers

    You're welcome. Thanks for the rep.

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,266

    Re: Split a Sequence of Numbers

    You're welcome.

  27. #27
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,556

    Re: Split a Sequence of Numbers

    Post #2 downgraded to work in 2021 (without HSTACK):
    Formula: copy to clipboard
    =LET(a,A2:A6,CHOOSE({1,2},LEFT(a,1),RIGHT(a,1)))


    And post #3:
    Formula: copy to clipboard
    =LET(a,A2:A6,CHOOSE({1,2},LEFT(a,1)+0,RIGHT(a,1)+0))
    Last edited by TMS; 01-07-2024 at 01:10 PM.

+ 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. Function to highlight numbers in sequence. Copy corresponding numbers
    By JM6544088 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-10-2022, 04:30 AM
  2. [SOLVED] Match two set of numbers to return matched numbers that are in sequence
    By lamlam28 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2021, 12:18 AM
  3. [SOLVED] Separate sequence of numbers with sequence of letters
    By dell001 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-02-2020, 07:09 AM
  4. Replies: 1
    Last Post: 08-17-2016, 08:42 AM
  5. How to convert a range of numbers to sequence of numbers in an array
    By MetisConnect in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-25-2015, 11:53 AM
  6. Replies: 3
    Last Post: 08-20-2013, 03:59 AM
  7. [SOLVED] Creating a sequence based on numbers in one column and adding "01,02..." to a new sequence
    By JCR1968 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2013, 08:06 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