ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can I sort a column of #s Rt to left? in a worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/91635-can-i-sort-column-s-rt-left-worksheet.html)

Concha94

Can I sort a column of #s Rt to left? in a worksheet
 
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

Gary L Brown

Can I sort a column of #s Rt to left? in a worksheet
 
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,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Concha94" wrote:

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



All times are GMT +1. The time now is 01:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com