ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date Time (https://www.excelbanter.com/excel-discussion-misc-queries/61199-date-time.html)

TBFJ

Date Time
 
Can Excel recognize 2400 hours as midnight today? Every formula I try forces
the date/time to show it as 1st thing tomorrow morning. ie, it adds one day
to the date, when it should not do so until 0001 hours.

Thanks in advance.

TBF

Gary''s Student

Date Time
 
That's because 2400 is the roll-over point.

In A1 thru C1 put:
2359 =TIME(A1/100,A1-100*INT(A1/100),0) =B1
and you will see:
2359 11:59 PM 0.9993055556 with the correct formatting

However if you put 2400 in A1 you will see:
2400 12:00 AM 0.0000000000 with the same formatting


--
Gary''s Student


"TBFJ" wrote:

Can Excel recognize 2400 hours as midnight today? Every formula I try forces
the date/time to show it as 1st thing tomorrow morning. ie, it adds one day
to the date, when it should not do so until 0001 hours.

Thanks in advance.

TBF


TBFJ

Date Time
 
That is what I suspected was the "Feature" of Excel. Do you know of a way to
correct this? I am working with weather data and the data that is summerized
at midnight is for the preceeding 24 hours, so should have that date on it,
not the next day's. The only way I have found is to do "if time=2400 then
date=date-1" but that is not really correct since that actually puts that
data at the beginning of the day instead of the end of the day.

Thanks for your thoughts === TBFJ



"Gary''s Student" wrote:

That's because 2400 is the roll-over point.

In A1 thru C1 put:
2359 =TIME(A1/100,A1-100*INT(A1/100),0) =B1
and you will see:
2359 11:59 PM 0.9993055556 with the correct formatting

However if you put 2400 in A1 you will see:
2400 12:00 AM 0.0000000000 with the same formatting


--
Gary''s Student


"TBFJ" wrote:

Can Excel recognize 2400 hours as midnight today? Every formula I try forces
the date/time to show it as 1st thing tomorrow morning. ie, it adds one day
to the date, when it should not do so until 0001 hours.

Thanks in advance.

TBF


Gary''s Student

Date Time
 
Move it back by one minute or even 1 second (if possible)

=IF(A1=2400,2359,A1)
--
Gary's Student


"TBFJ" wrote:

That is what I suspected was the "Feature" of Excel. Do you know of a way to
correct this? I am working with weather data and the data that is summerized
at midnight is for the preceeding 24 hours, so should have that date on it,
not the next day's. The only way I have found is to do "if time=2400 then
date=date-1" but that is not really correct since that actually puts that
data at the beginning of the day instead of the end of the day.

Thanks for your thoughts === TBFJ



"Gary''s Student" wrote:

That's because 2400 is the roll-over point.

In A1 thru C1 put:
2359 =TIME(A1/100,A1-100*INT(A1/100),0) =B1
and you will see:
2359 11:59 PM 0.9993055556 with the correct formatting

However if you put 2400 in A1 you will see:
2400 12:00 AM 0.0000000000 with the same formatting


--
Gary''s Student


"TBFJ" wrote:

Can Excel recognize 2400 hours as midnight today? Every formula I try forces
the date/time to show it as 1st thing tomorrow morning. ie, it adds one day
to the date, when it should not do so until 0001 hours.

Thanks in advance.

TBF



All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com