Sorting with rules

S

spolk

Hi have faced the following problem: I should sort a big amount of dat
according to the the column A (Soils), but NOT in alphabetic order. Th
order I need is shown below. I am considering to use some kind of macro
which is checking the name of a value in column A(FAO) and if is e.
"Lithic leptosol" the row will be moved to the top position and so on
Anyone knows a ready made code sample for this kind of purpose?



A | B |
C

FAO | AREA Ha | MAPSHEET
Lithic Leptosol | 4322 | 6,9%
Dystric Leptosol 1 | 5217 | 8,4%
Haplic Podzol 1 | 31724 | 51,0%
Haplic Podzol 2 | 1891 | 3,0%
Eutric Regosol | 2162 | 3,5%
Vertic Cambisol | 517 | 0,8%
Fibric/Terric Histosol | 9813 | 15,8%
Fibric/Terric Histosol | 4201 | 6,7%
Fibric/Terric Histosol | 78 |
0,1%
Gleyic Podzol 1 | 2113 | 3,4%
Gleyic Podzol 2 | 44 | 0,1%
Umbric Gleysol 1 | 48 | 0,1%
Umbric Gleysol 2 | 124 | 0,2
 
G

Guest

hi,
excel will only sort aphabeticly accending or descending.
to so what you want you might have to add a sort column (a
helper column). in the sort column put a number by the item
for example lithic = 1, dystric = 2, haplic = 3 and so on.
then sort by the sort column. you may be able to write a
macro to assing the numbers. i have use this techique
to "sort by colors".
 
D

Debra Dalgleish

You can create a custom list, and use it as the sort order.

To create the list:
Type the list on the worksheet
Select the list
Choose Tools>Options
Select the Custom List tab
Click the Import button
Click OK

To sort in the custom order:
Select the cells that you want to sort
Choose Data>Sort
Click Options
From the 'First key sort order' dropdown, choose your list
Click OK, click OK
--Only the first key in a multi-key sort can use the custom list.
 
Top