Page 1 of 1

Problem with Numeric Sort?

Posted: Mon Oct 13, 2008 8:28 pm
by dougwong55
I have a number of dates, 1 per line, in descending order. I would like to sort them in ascending order. When I select the seemingly logical "numeric" sorting things come out funny, but when I select "case sensitive" or "case insensitive" everything is fine. There are only about 145 dates so far, so I'm not exceeding any limit and the dates are all in 2008, so there is no year wrap. This has bitten me more than once. I can remember the workaround better if I understand what's going on. Does anyone know what is the matter? Thanks in advance.

Sort Options:
Key 1: column 1, length 10
Ascending checked.
In character code order checked.

portion of original data. dates in U.S. date format: month/day/year
...
07/21/2008
07/21/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/19/2008
07/19/2008
07/19/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/17/2008
07/17/2008
...

sorted in numeric order
...
07/17/2008
07/17/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/31/2008
07/31/2008
07/31/2008
07/31/2008
07/31/2008
07/31/2008
07/31/2008
07/31/2008
07/30/2008
07/30/2008
07/30/2008
07/29/2008
07/29/2008
07/29/2008
07/29/2008
07/29/2008
07/29/2008
...

sorted in case sensitive
...
07/17/2008
07/17/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/18/2008
07/19/2008
07/19/2008
07/19/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/20/2008
07/21/2008
07/21/2008
...

Posted: Tue Oct 14, 2008 12:15 am
by Bob Hansen
Treat them as text strings, not as numbers. Numbers do not have "/" in them, that is a "division" symbol.

Sorting as text, case sensitive/insensitive both do a perfect sort.

Posted: Tue Oct 21, 2008 9:44 am
by bveldkamp
Obviously it won't work if the dates span multiple years