Can I sort a column of #s Rt to left? in a worksheet

C

Concha94

I have a series or land parcel IDs. They are vertical in a column. I want to
sort them from right to left digits in the cell instead of the usual Rt to
left.

Example: Row 1. 076 88 0013
Row 2 1104 87 2311
Row 3 232 443 3779
Row 4 1167 225 B991

I want to sort ,based on the last four digits in the cell in a
Decending/Ascending as needed.

Example Row 1. 1104 87 2311
Row 2 1167 225 B991
Row 3 076 88 0013
Row 4 232443 3779

Thanks any help would be appreciated
 
G

Gary L Brown

Use a 'cheat' column that gets the last digit(s),ie: right(C17,1), then sort
on that column.
You could also create a user-defined-function and put that in the 'cheat'
function.
Such as...
'/===========================================================/
' Function Purpose: Reverse the order of characters in cell
'
Public Function ReverseMe(Select_Cell As Range) As String
Dim i As Integer
Dim strResult As String

Application.Volatile

On Error GoTo err_Function

If Len(Select_Cell.Value) <> 0 Then
For i = Len(Select_Cell.Value) To 1 Step -1
strResult = strResult & Mid(Select_Cell.Value, i, 1)
Next i
End If

ReverseMe = strResult

exit_Function:
On Error Resume Next
Exit Function

err_Function:
Debug.Print "Error: " & Err.Number & " - (" & _
Err.Description & _
") - Function: ReverseMe - " & Now()
Resume exit_Function

End Function
'/===========================================================/

For example, if cell B15 is 1a2b, the formula
=ReverseMe(B15)
would show b2a1.
I think that's what you want to sort on, right?

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top