Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
craigcsb
 
Posts: n/a
Default Compare dates (one cell not in date format)


Hi all,

I have one column of cells in date format (6/14/2005) and another
column of cells which also contains a date pulled from a database but
this second column is not in date format, it comes from the database
like this 2005Jan20. I need to compare the two dates to work out the
number of days between the dates but I can't convert the second date to
date format.

Is there any way I can work out the number of days between the two
dates?

Thanks in advance
Craig


--
craigcsb
------------------------------------------------------------------------
craigcsb's Profile: http://www.excelforum.com/member.php...o&userid=24710
View this thread: http://www.excelforum.com/showthread...hreadid=382752

  #2   Report Post  
bj
 
Posts: n/a
Default

If the month is always three letters and the day is always 2 digits, uses a
helper column and enter
=MID(A1,5,3)&" "&RIGHT(A1,2)&" "&LEFT(A1,4)
Copy down to the end of the data
copy this column and paste special values on top of itself
Select this column
<Data<Text to Column next-next Select date
The input data is now in date format.

"craigcsb" wrote:


Hi all,

I have one column of cells in date format (6/14/2005) and another
column of cells which also contains a date pulled from a database but
this second column is not in date format, it comes from the database
like this 2005Jan20. I need to compare the two dates to work out the
number of days between the dates but I can't convert the second date to
date format.

Is there any way I can work out the number of days between the two
dates?

Thanks in advance
Craig


--
craigcsb
------------------------------------------------------------------------
craigcsb's Profile: http://www.excelforum.com/member.php...o&userid=24710
View this thread: http://www.excelforum.com/showthread...hreadid=382752


  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I don't even think you need the formula.

Just do Data|Text to columns. Choose fixed width (don't have any separator
lines).

Choose ymd as the format and finish up.

Format the column the way you like.


bj wrote:

If the month is always three letters and the day is always 2 digits, uses a
helper column and enter
=MID(A1,5,3)&" "&RIGHT(A1,2)&" "&LEFT(A1,4)
Copy down to the end of the data
copy this column and paste special values on top of itself
Select this column
<Data<Text to Column next-next Select date
The input data is now in date format.

"craigcsb" wrote:


Hi all,

I have one column of cells in date format (6/14/2005) and another
column of cells which also contains a date pulled from a database but
this second column is not in date format, it comes from the database
like this 2005Jan20. I need to compare the two dates to work out the
number of days between the dates but I can't convert the second date to
date format.

Is there any way I can work out the number of days between the two
dates?

Thanks in advance
Craig


--
craigcsb
------------------------------------------------------------------------
craigcsb's Profile: http://www.excelforum.com/member.php...o&userid=24710
View this thread: http://www.excelforum.com/showthread...hreadid=382752



--

Dave Peterson
  #4   Report Post  
bj
 
Posts: n/a
Default

When I tried the ext to columns this format did not convert. I may have done
something wrong, but went ahead and did the convert before.

"Dave Peterson" wrote:

I don't even think you need the formula.

Just do Data|Text to columns. Choose fixed width (don't have any separator
lines).

Choose ymd as the format and finish up.

Format the column the way you like.


bj wrote:

If the month is always three letters and the day is always 2 digits, uses a
helper column and enter
=MID(A1,5,3)&" "&RIGHT(A1,2)&" "&LEFT(A1,4)
Copy down to the end of the data
copy this column and paste special values on top of itself
Select this column
<Data<Text to Column next-next Select date
The input data is now in date format.

"craigcsb" wrote:


Hi all,

I have one column of cells in date format (6/14/2005) and another
column of cells which also contains a date pulled from a database but
this second column is not in date format, it comes from the database
like this 2005Jan20. I need to compare the two dates to work out the
number of days between the dates but I can't convert the second date to
date format.

Is there any way I can work out the number of days between the two
dates?

Thanks in advance
Craig


--
craigcsb
------------------------------------------------------------------------
craigcsb's Profile: http://www.excelforum.com/member.php...o&userid=24710
View this thread: http://www.excelforum.com/showthread...hreadid=382752



--

Dave Peterson

  #5   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Tue, 28 Jun 2005 05:42:41 -0500, craigcsb
wrote:


Hi all,

I have one column of cells in date format (6/14/2005) and another
column of cells which also contains a date pulled from a database but
this second column is not in date format, it comes from the database
like this 2005Jan20. I need to compare the two dates to work out the
number of days between the dates but I can't convert the second date to
date format.

Is there any way I can work out the number of days between the two
dates?

Thanks in advance
Craig


To convert your database derived dates to Excel date format:
1. Select the range of dates to be converted.
2. Data/Text To Columns
Next
Next
Column Data Format
Date YMD
Finish

3. Then merely subtract one from the other. In other words, if one set of
dates is in column A, and the other set in column B, then =B2-A2 will give the
difference in days. Be sure to format this as General or as Number.


--ron


  #6   Report Post  
Domenic
 
Posts: n/a
Default


Try...

=A1-DATEVALUE(MID(B1,5,3)&" "&LEFT(B1,2)&", "&LEFT(B1,4))

...where A1 contains your first date, such as 6/14/2005, and B1
contains your second date, such as 2005Jan20.

Hope this helps!

craigcsb Wrote:
Hi all,

I have one column of cells in date format (6/14/2005) and another
column of cells which also contains a date pulled from a database but
this second column is not in date format, it comes from the database
like this 2005Jan20. I need to compare the two dates to work out the
number of days between the dates but I can't convert the second date to
date format.

Is there any way I can work out the number of days between the two
dates?

Thanks in advance
Craig



--
Domenic
------------------------------------------------------------------------
Domenic's Profile: http://www.excelforum.com/member.php...o&userid=10785
View this thread: http://www.excelforum.com/showthread...hreadid=382752

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
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
format the "date" button for a header sc11 Excel Discussion (Misc queries) 1 May 12th 05 03:48 AM
can't format cell - have tried unlocking and unprotecting griffin Excel Discussion (Misc queries) 1 April 5th 05 02:11 AM
DOS Data in Excel Format with Date and Military Time in same cell Jules Excel Worksheet Functions 1 March 14th 05 09:31 PM
Date format on a drop down box Steven Cheng Excel Discussion (Misc queries) 6 February 9th 05 03:13 AM


All times are GMT +1. The time now is 05:35 PM.

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"