How to auto sort numeric then alpha charaters!

Crazy1923

New Member
Joined
Aug 11, 2011
Messages
24
Hi,

Do anyone knows how to automatically sort numeric digits and if the value is the same it will auto sort for the alpha characters. For example:

B 22
C 42
D 10
A 10
E 22

I need to make it like this:

A 10
D 10
B 22
E 22
C 42

How can I make it by using a formula? Any help will be appreciated
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
In column A try:
Code:
Sub Ordinament()
Dim v(), vt() As Variant
Dim i, j, n As Integer
'load vector
n = Cells(Rows.Count, 1).End(xlUp).Row
n = n - 1
ReDim v(n) As Variant
'ordinament vector
Position = 1
For cicle = 1 To 2
For i = 1 To n
v(i) = Mid(Cells(i + 1, 1), Position, 2)
Next i
For i = n - 1 To 1 Step -1
For j = 1 To i
If v(j) >= v(j + 1) Then
a = v(j)
v(j) = v(j + 1)
v(j + 1) = a
End If
Next j
Next i
'riposition vector
For i = 1 To UBound(v)
Cells(i, 3) = Cells(i, 3) & v(i)
Next i
Position = 3
Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,756
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top