+ Reply to Thread
Results 1 to 3 of 3

Digits in ascending order ?

  1. #1
    toyota58
    Guest

    Digits in ascending order ?

    Hello,


    Anyone knows how to sort digits in ascending order ?


    Example :

    Cell A1 = 3176
    Cell A2 = 1367


    Cell A1 = 704182
    Cell A2 = 012478



    Thank You.


  2. #2

    Re: Digits in ascending order ?

    Hello,

    I suggest to take this UDF:

    Option Explicit

    Function sort_digits(s As String) As String
    Dim a(0 To 9) As Long, i As Long

    For i = 1 To Len(s)
    a(Mid(s, i, 1)) = a(Mid(s, i, 1)) + 1
    Next i

    For i = 0 To 9
    sort_digits = sort_digits & String(a(i), Chr(Asc("0") + i))
    Next i

    End Function

    HTH,
    Bernd


  3. #3
    toyota58
    Guest

    Re: Digits in ascending order ?

    Thank You so much...


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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