sorting hybrid text/numbers/dashes

A

Andy

Hello

I have a table with a column where the format is Chapter-Page#letter, e.g.
23-142a, 24-11b

I've been trying to get it to sort so it sorts Chapter number, then page
number, then a,b,c etc. No matter what I try, it will not work properly. It
won't sort the first number correctly.

What's the proper set up for this sort?
Thanks
Andrew
 
H

Helmut Weber

Hi Andy,

so many ways...
I have a table with a column where the format
is Chapter-Page#letter, e.g.
23-142a, 24-11b

One method would be to add leading zeros before sorting
and then sorting as text,
then remove the leading zeros again.

For that method you'd have to find out,
how many digits the largest number before the dash has
and the same for the number following the dash.
Or you just know, three digits is sufficient.

23-142a -> 023-142a
24-11b -> 024-011b
1-333f -> 001-333f
333-1x -> 333-001x

I think, one could use excel as well,
to avoid programming, but that's no fun.

Do you need details?

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top