Sorting by number digits from left to right instead of right to left
Author Message
Sorting by number digits from left to right instead of right to left

Is there a way to sort numbers backwards, that is by left
to right instead of the normal right to left?

For example, I want to be able to sort the following
numbers

1230606
1231
1240606
1240118

in this order:

1231
1230606
1240606
1240118

The first 3 digits of these numbers identify a product,
and the rest of the digits identify package size (or
category).

I want to be able to sort by category.

Sat, 18 Jun 2005 22:24:38 GMT
Sorting by number digits from left to right instead of right to left
I'm not sure how sort numbers backwards works, but this might work.

Insert two additional columns directly to the right of your numbers column.

Then Data|Text to columns
Choose Fixed width
Draw a line right after the first 3 digits.
Make sure both fields are treated as text
and put them in the cell to the right of the first cell in the column.
(If your data is in A1:a99, put the text-to-column data in B1.)

Then select your complete range and sort by the first helper column (ascending)
and the second column (Descending).

(Delete the helper columns if you want.)

========
You could also use these two formulas in the two helper columns:

In the first helper column:
=LEFT(A1,3)

in the second:
=MID(A1,4,255)

Drag down and do the sort the same way.

Quote:

> Is there a way to sort numbers backwards, that is by left
> to right instead of the normal right to left?

> For example, I want to be able to sort the following
> numbers

> 1230606
> 1231
> 1240606
> 1240118

> in this order:

> 1231
> 1230606
> 1240606
> 1240118

> The first 3 digits of these numbers identify a product,
> and the rest of the digits identify package size (or
> category).

> I want to be able to sort by category.

--

Dave Peterson

Sun, 19 Jun 2005 00:39:26 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages