#1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sorting by date

OK this one is definitely for the experts here.

I have a listing with about 6 columns and 100 rows of data.
I'd like to sort the data by the date column.
The problem is that currently, the date column has the date in the
following text format:

Thu Jun 15-Sat Jun 17
Fri Jun 9-Mon Jun 19, var. concerts/ venues
Sat Jun 23-Sat Aug 26, many concerts


So in addition to being a text field, there is sometimes extra text
added at the end of the field.

Would anyone here be able to tell me how I can sort all of this data
chronologically by date?

TIA Ric

  #2   Report Post  
Posted to microsoft.public.excel.misc
Peo Sjoblom
 
Posts: n/a
Default Sorting by date

You can't, you need to parse out the dates from it but what is more
confusing is that you have 2 dates and excel will never accept that as
numbers
so before anyone can help you parsing it they need to know which of the 2
dates you want to sort by, for instance

Sat Jun 23-Sat Aug 26

how could you ever sort that, it spans 2 months?

Excel will only accept as date

06/23/06 or 08/26/06 (US format) , if you would go for the first date and if
it always start with

weekday space month space day hyphen

then you could use

=--MID(LEFT(A2,FIND("-",A2)-1),5,255)

to get the first date, note you need to format as date or you'll get the
date's serial number





--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
"It is a good thing to follow the first law of holes;
if you are in one stop digging." Lord Healey


wrote in message
oups.com...
OK this one is definitely for the experts here.

I have a listing with about 6 columns and 100 rows of data.
I'd like to sort the data by the date column.
The problem is that currently, the date column has the date in the
following text format:

Thu Jun 15-Sat Jun 17
Fri Jun 9-Mon Jun 19, var. concerts/ venues
Sat Jun 23-Sat Aug 26, many concerts


So in addition to being a text field, there is sometimes extra text
added at the end of the field.

Would anyone here be able to tell me how I can sort all of this data
chronologically by date?

TIA Ric



  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sorting by date

Peo Sjoblom wrote:
You can't, you need to parse out the dates from it but what is more
confusing is that you have 2 dates and excel will never accept that as
numbers
so before anyone can help you parsing it they need to know which of the 2
dates you want to sort by, for instance



Yes I realized that I'd have to parse first, I just didn't know how.


... if you would go for the first date and if
it always start with

weekday space month space day hyphen

then you could use

=--MID(LEFT(A2,FIND("-",A2)-1),5,255)



Yes the first date of the two would be fine.
All the dates are pretty uniform in this formatting so it should work.

Now my only problem is that I don't know how to apply the above
formula to parse my data.
What cell do I place the formula in and how do I make it work on my
data?
Also, are there supposed to be those two '--' in front of the MID
expression?
BTW what's the 5, 255 for?

TIA Ric

  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sorting by date


Hi Peo,

I figured out how to parse the data with your formula!
Thanks very much. It works very nicely.

I have just one more question. Now that I have parsed the data in a
separate column,
do I just sort all the data by this new column? Will Excel
It's giving now something like:

Jun 15
Aug 9
Jul 21
Aug 10
Jun 23

TIA Ric

  #5   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sorting by date


Hi Peo,

As I suspected we're not quite there yet.
I tried to sort based on the new column and ended up with

August 1
August 10
August 22
June 4
June 12
June 22
May 2
May 5
etc.

Obviously I have to fiddle with the dates some more before it will
work.
Any suggestions now?

TIA Ric



  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Sorting by date

Your dates aren't really dates--they're just text.

I'm betting that you didn't use this formula from Peo:

=--MID(LEFT(A2,FIND("-",A2)-1),5,255)

The -- stuff changed the text "dates" into real dates. Excel knows dates by
keeping them numbers. The -- coerces the text that looks like a date into a
number (first a negative number, then it reverses the sign with the second
minus.)

The =mid() function will want to start in the 5th position for 255 characters.
That's just Peo's way of grabbing everything he needs.

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

wrote:

Hi Peo,

As I suspected we're not quite there yet.
I tried to sort based on the new column and ended up with

August 1
August 10
August 22
June 4
June 12
June 22
May 2
May 5
etc.

Obviously I have to fiddle with the dates some more before it will
work.
Any suggestions now?

TIA Ric


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Sorting by date

Dave Peterson wrote:
Your dates aren't really dates--they're just text.

I'm betting that you didn't use this formula from Peo:

=--MID(LEFT(A2,FIND("-",A2)-1),5,255)



Thanks Dave, you were quite correct with your bet!
I did remove the -- in front of MID thinking it was extraneous.

I tried out the full formula and it works like a charm!
Thanks again and also for the extra reading.

Ric

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula for determining if two date columns fall within specific date range Igottabeme Excel Worksheet Functions 2 April 21st 06 02:50 AM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Discussion (Misc queries) 1 April 20th 06 10:03 PM
NETWORKDAYS - Multiple Date Selection Annabelle Excel Discussion (Misc queries) 3 October 4th 05 07:04 PM
sorting data by date Katherine Excel Worksheet Functions 1 June 17th 05 03:12 PM
Sorting data by date Katherine Excel Worksheet Functions 2 June 14th 05 02:37 PM


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"