+ Reply to Thread
Results 1 to 12 of 12

Single digit and double digit numbers sequence within a cell

  1. #1
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Single digit and double digit numbers sequence within a cell

    Hello,

    I have some numbers entered in a single cell. These numbers are separated by space only. Some of these numbers are single digit and some are of double digit. I want to arrange them in proper sequence in that cell only and not in another cell.

    For example i have value 22 14 15 2 1 recorded within a cell. I want in the form either 1 2 14 15 22 or 1, 2, 14, 15, 22. No matter whether digits are separated by space or comma.

    Please suggest VBA code.
    As i am getting these values form customers in single cell only i can not or do not want to get output result in another cell.

    For understanding i am giving attachment with this thread.

    Thanks a lot in advance.
    Last edited by chintamani.avinash; 09-11-2020 at 12:46 PM.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Single digit and double digit numbers sequence within a cell

    Give this macro a try (it work on whatever cell is selected)...
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    Thanks, it is working for single digit number but it does not identify double digit number. It identify double digit number as two single digit number i.e. 15 is considered as 1 and 5. I test this for 5 2 15, expected result should be 2 5 15 but i am getting 15 2 5. Please suggest any solution for this.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Single digit and double digit numbers sequence within a cell

    Try:

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  5. #5
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    great, its working. Thanks a lot. Thanks for your help.
    Last edited by chintamani.avinash; 09-10-2020 at 05:55 PM.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Single digit and double digit numbers sequence within a cell

    Quote Originally Posted by chintamani.avinash View Post
    Thanks, it is working for single digit number but it does not identify double digit number. It identify double digit number as two single digit number i.e. 15 is considered as 1 and 5. I test this for 5 2 15, expected result should be 2 5 15 but i am getting 15 2 5. Please suggest any solution for this.
    Give this modified version of my original macro a try...
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    Thanks a lot for your help.

  8. #8
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    Above codes are working smoothly.

    in some cells values are generated by formula. some of them are array. For those cells when i run above code, i get error "Type Mismatch'. Please suggest solution.
    Last edited by chintamani.avinash; 09-11-2020 at 01:00 PM.

  9. #9
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    It works dear but it remove zero from the double digit number who has zero in last e.g. 10 becomes 1, 20 becomes 2.

  10. #10
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    Quote Originally Posted by millz View Post
    Try:

    Please Login or Register  to view this content.
    When i tried to use it in the cell where formula exists and value is taken from it shows type mismatch error. Can i sort values in within a cell where formula won't be disturbed and cell will be sorted?

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Single digit and double digit numbers sequence within a cell

    Use like
    =SortInCell(A1)
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    11-24-2019
    Location
    India
    MS-Off Ver
    Ms. Office 2016
    Posts
    169

    Re: Single digit and double digit numbers sequence within a cell

    Quote Originally Posted by jindon View Post
    Use like
    =SortInCell(A1)
    Please Login or Register  to view this content.
    Thanks a lot for your help. Grt work of yours

+ 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] How to subtract single cells with double digits into a single digit of a single cell.
    By greenfox74 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-11-2021, 02:05 AM
  2. Google Sheets: Sum each digit in Cell to Double and Single Digit
    By rbhapkar in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 11
    Last Post: 12-27-2019, 08:41 AM
  3. Google Sheets: Sum each digit in Cell to Double and Single Digit
    By rbhapkar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2019, 01:47 AM
  4. [SOLVED] Macro to convert WBS single digit numbers to double digit numbers
    By LeanAccountant in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 06-09-2018, 05:25 AM
  5. IF(ISNUMBER(SEARCH single and double digit numbers
    By marie branigan in forum Excel General
    Replies: 5
    Last Post: 09-16-2015, 06:08 PM
  6. [SOLVED] Countif & Sumif with single and double digit numbers mixed in same column.
    By hoventim in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-15-2015, 03:19 PM
  7. [SOLVED] LOTTERY FILTER#4, Find if 1 Digit Sum of 2 Digit or 3 Digit, Single Cell w/ dash
    By david gonzalez in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2014, 12:57 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