View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK
 
Posts: n/a
Default sorting more than 3 columns

Another way is to join columns together in a helper column, eg in F2
enter the formula:

=A2&B2&C2&D2 &E2

copy down, and sort on this one field. The fields should be converted
to fixed width if they are not already. If the field is text then
spaces can be added to make it up to a fixed number of characters, and
if it is numeric it can be made fixed width using TEXT( ). So you might
actually have something like:

=A2&B2&REPT(" ",20-LEN(B2))&C2&REPT(" ",10-LEN(C2))&TEXT(D2,"000")&E2

Here A2 is already fixed width (eg code number), B2 is made up to 20
characters, C2 is made up to 10 characters, D2 is a number fixed to 3
characters and E2 is not changed. The advantage is only one sort is
needed.

Of course, this leaves two other slots in the sort dialogue box for
further refinement.

Hope this helps.

Pete