Time Format Problem

G

Guest

I have an excel spreadsheet with a field with the time format "7:00:00 AM".
When I import this spreadsheet, the value showing in the Import Spreadsheet
Wizard is .29166666667. Each time value has a different number similar to
this representing the cumulative percentage of the day gone by (i.e. 12:00 PM
has a value of .5). The problem is that when I try to use this field in a
query to match up two times, most of the times do not match. I am guessing
this is because the decimals are too long. The only times that match are the
smaller decimals such as 12:00 PM (.5) or 10:30 AM (.4375). Does anyone know
of a way around this? Any help is greatly appreciated.

Matt.
 
D

Douglas J. Steele

You could format the times, and compare them:

?.29166666666 = .29166666668
False
?Format(.29166666666, "hh:nn:ss") = Format(.29166666668, "hh:nn:ss")
True

Another possibility is to use the techniques from Numerical Methods. Decide
what's "close enough", and compare the difference between the values to that
threshold:

?Abs(.29166666666 - .29166666668) < 0.0005
True
 

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