ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do you change sort defaults for combined text number & hyphen. (https://www.excelbanter.com/excel-discussion-misc-queries/21097-how-do-you-change-sort-defaults-combined-text-number-hyphen.html)

Anna

How do you change sort defaults for combined text number & hyphen.
 
I'm trying to sort an array of part numbers such as (3000, 3000P, 3000-10,
3000-10P, 30000P) and would like them to appear in that order. But I see
that Excel ignores hyphens, which is part of the problem. Is there anyway I
can change the data sorting defaults so the part numbers appear is this order?

Myrna Larson

Another part of the problem is that you want the data to be treated as a
number followed by text. Excel can't do that unless you either split the data
into 2 columns - number part and text part -- or you pad the numeric portion
on the left with spaces to the maximum possible length of the number (i.e. 5
digits in the data you show).

So let's say you use 2 "helper" columns in which you've done that split.
You'll have to put a space in the 2nd column for those entries that consist of
a number only (if it's blank, that row will sort to the bottom).

As for the hyphen problem, you can replace the hyphen with a character that
sorts after Z. One character that might work is character 158, an accented z.
Then you can sort with these 2 columns as the keys.

As far as I can see, this is the only way to get the order you want.

On Thu, 7 Apr 2005 20:23:03 -0700, "Anna"
wrote:

I'm trying to sort an array of part numbers such as (3000, 3000P, 3000-10,
3000-10P, 30000P) and would like them to appear in that order. But I see
that Excel ignores hyphens, which is part of the problem. Is there anyway I
can change the data sorting defaults so the part numbers appear is this

order?



All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com