Not sure if this is what you mean. The function below converts "4824" to "2448". You can filter to remove duplicates.
Function AnaSort(sInp As String, Optional bUniq As Boolean = False) As String
' Returns the characters of sInp in alpha order: AnaSort("amaze") = "aaemz"
' with option to return unique characters only: AnaSort("amaze", True) = "aemz"
Dim i As Long ' index to string characters
Dim aiNum(0 To 255) As Long ' count of characters by code
Dim iAsc As Long ' index to aiNum
For i = 1 To Len(sInp)
iAsc = Asc(Mid(sInp, i, 1))
aiNum(iAsc) = aiNum(iAsc) + 1
Next
If bUniq Then
For iAsc = 0 To 255
If aiNum(iAsc) Then AnaSort = AnaSort & Chr$(iAsc)
Next
Else
For iAsc = 0 To 255
AnaSort = AnaSort & String$(aiNum(iAsc), Chr$(iAsc))
Next
End If
End Function
Bookmarks