Puppiie -
You confusion is GREAT! As we try to give answers, it's important for us to understand your question. You have to decide if 01234 is the same as 43210. It was not obvious, to me, from your original post.
I decided you wanted to say that 12345 was the same as 54321. I've written a User Defined Function that sorts (from small to large) 5 digits and returns the value. Example 54321 = 12345 , 13245 = 12345 ect.
If you use this function in a column next to your text digits it will be easier to tell which are the same, as the value will be the same.
'This function takes a 5 character long string
'Made up of digits from 0-9 (no repeating digits)
'Returns the minimim value of the 5 digits as a test for uniqueness
Function MinValue5String(NumStr As String) As Double
Dim Ctr As Integer
Dim Ctr2 As Integer
Dim Vals(5) As Integer
Dim SortVals(5) As Integer
Dim MinVal As Double
'Test to see if exactly 5 character long string
If Len(NumStr) <> 5 Then
MsgBox ("Need 5 characters in the number string")
GoTo Not5Long
End If
For Ctr = 1 To 5
Vals(Ctr) = Mid(NumStr, Ctr, 1)
Next Ctr
'Sort the numbers small to large
For Ctr2 = 1 To 4
For Ctr = 1 To 4
If Vals(Ctr) > Vals(Ctr + 1) Then
Vals(0) = Vals(Ctr)
Vals(Ctr) = Vals(Ctr + 1)
Vals(Ctr + 1) = Vals(0)
End If
Next Ctr
Next Ctr2
'Test to see if any digits repeat
For Ctr = 1 To 4
If Vals(Ctr) = Vals(Ctr + 1) Then
MsgBox ("Two digits are the same - not allowed")
GoTo Not5Long
End If
Next Ctr
'Build value of digits
MinValue5String = 0
For Ctr = 1 To 5
MinValue5String = MinValue5String + Vals(Ctr) * 10 ^ (5 - Ctr)
Next Ctr
Not5Long:
End Function
To use the above User Defined Function (UDF)
If A1 contains "43267" (any 5 character string of digits)
In B1 type "=MinValue5String(A1)"
B1 will then show the value 23467.
I'm not sure this answers your entire question but may be a start for determining if any 2 Five Digit strings have the same exact 5 digits in them as another (based on their minimum 5 digit values).
Bookmarks