Re-ordering Rows

B

Bob Manjoney

I am using Excell 2003.

I have a range of cells that are sorted thusly

Col1 Col2 ... Coln
-------------------------
a ... ...
b ... ...
c ... ...
d ... ...
e ... ...

Where a,b,c,d,e is in the first column, and the remaining columns are
represented by the ellipsis.

Now, someone comes along and says - please re-order your table according to:

c, b, a, e, d (some arbitrary first column sort order).

Is there an easy way to apply an arbitrary ordering of the rows, given just
the desired order of the first column?

TIA,
Bob
 
D

Dave Peterson

Maybe you could define a custom list and use that as the key to sort.

Or maybe you could create a table (on another sheet) with the sort order in
column B and the keys in column A. Then use an =vlookup() formula to retrieve
that sort order value into a helper column and then sort the data by that helper
column.

In Sheet2:
A B
- -
a 3
b 2
c 1
d 5
e 4

And in that helper column, you'd have formulas like:
=vlookup(a1,sheet2!a:b,2,false)
 
Top