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.

Select your number columns
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  
 
 [ 2 post ] 

 Relevant Pages 

1. How to print left and right footers at same location as left and right margin setting

2. right-to-left to left-to-right

3. Changing input from left>right to right>left

4. Left-to-Right and Right-to-Left Paragraphs

5. sorting a column of numbers and reading them right to left

6. Recursive left to right sort

7. Sorting Right to Left: Is this Possible?

8. sorting row by row left to right

9. sorting data from left to right using automation or macros

10. Fill phone number from right to left?


 
Powered by phpBB® Forum Software © phpBB Group