ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Sort Routine (https://www.excelbanter.com/excel-programming/418365-custom-sort-routine.html)

[email protected]

Custom Sort Routine
 
I have a header and several rows of data that i'd like to routinely
sort in a peculiar way:

There is a field that consists of a 1 alphanumeric character followed
by 5 numeric characters.

Ex: a123434, b234344, 434563, etc.

I'd like to create a function that sorts these numbers by their last
three (numeric) digits.

The only method I know is copy the entire sheet to a temp sheet,
ammend each row with an ordinal value, and then copy the contents back
to the original sheet in the correct order.

Another method i've considered is a hidden row with a formula
resembling this; right(a1,3). I would then sort by this hidden row.

Does anyone have a more elegant VBScript option?

joel

Custom Sort Routine
 
The hidden column method is the usual method of doing this sort.

" wrote:

I have a header and several rows of data that i'd like to routinely
sort in a peculiar way:

There is a field that consists of a 1 alphanumeric character followed
by 5 numeric characters.

Ex: a123434, b234344, 434563, etc.

I'd like to create a function that sorts these numbers by their last
three (numeric) digits.

The only method I know is copy the entire sheet to a temp sheet,
ammend each row with an ordinal value, and then copy the contents back
to the original sheet in the correct order.

Another method i've considered is a hidden row with a formula
resembling this; right(a1,3). I would then sort by this hidden row.

Does anyone have a more elegant VBScript option?



All times are GMT +1. The time now is 05:22 PM.

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