Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Cathy
 
Posts: n/a
Default Comparing Date Fields

I have two date fields that are linked into one master spreadsheet from two
different sources. Once in the master spreadsheet they need to be compared.
When looking at the sources, they appear to both be true dates with a date
format. But when I try to compare them, they do not match. I have tried to
concantenate each with another field (a corresponding hour). When I perform
the concantenation I find that the two dates behave differently. One stays
in mm/dd/yyyy format, and the other becomes the Excel representation of a
date (ie 37989 = 1/3/2004). So then I added 'TEXT' logic to the dates. They
still will not compare properly. What else can I try?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Those concatenated cells that didn't change to a number is a clue that the value
in the original cell isn't really a data--it's just text masquerading as a
date. (Dates are just numbers to excel--formatted nicely for human's.)

You should be able to convert your text dates to real dates by selecting your
range (one column at at time) and then data|text to columns.

Choose fixed width and remove any lines that excel guessed.
make sure you choose the correct date style (mdy?)

then plop it right over the original range.

Then compare your cells once more.

And if you want to concatenate cells and include that formatting, you can use:

=a1&text(b1,"mm/dd/yyyy")

or if a1 contained a date and b1 a time:

=text(a1+b1,"mm/dd/yyyy hh:mm:ss")

But this formatting is just for you.

comparing two dates (even formatted differently) will match if the underlying
values match.

Cathy wrote:

I have two date fields that are linked into one master spreadsheet from two
different sources. Once in the master spreadsheet they need to be compared.
When looking at the sources, they appear to both be true dates with a date
format. But when I try to compare them, they do not match. I have tried to
concantenate each with another field (a corresponding hour). When I perform
the concantenation I find that the two dates behave differently. One stays
in mm/dd/yyyy format, and the other becomes the Excel representation of a
date (ie 37989 = 1/3/2004). So then I added 'TEXT' logic to the dates. They
still will not compare properly. What else can I try?


--

Dave Peterson

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
Date issue between Windows and Macintosh version dlg1967 Excel Discussion (Misc queries) 4 January 19th 05 04:51 PM
Autofilter on date fields should refelct the underlying data (rat. mrpb Excel Discussion (Misc queries) 5 January 18th 05 04:11 PM
Addition to Turn cell red if today is greater or equal to date in cell Rich New Users to Excel 2 December 9th 04 03:06 AM
Formatting date fields after export Raymond Excel Discussion (Misc queries) 2 December 1st 04 01:04 AM
Sum function on multiple date fields rbrooks Excel Worksheet Functions 1 October 28th 04 09:56 PM


All times are GMT +1. The time now is 08:48 PM.

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

About Us

"It's about Microsoft Excel"