Formatting Midnight in a date to 24 instead of 0:00

shepcs

Board Regular
Joined
Feb 2, 2003
Messages
70
Office Version
  1. 365
Platform
  1. Windows
Is there anyway by number formatting to change a database showing midnight at 0:00 the next day but rather as 24 the previous? I've messed around with some custom formatting I've seen but cant get it to work

Book1
I
5RAW DATA
6Date/Time
7
81/1/2018 0:00
91/1/2018 1:00
101/1/2018 2:00
111/1/2018 3:00
121/1/2018 4:00
131/1/2018 5:00
141/1/2018 6:00
151/1/2018 7:00
161/1/2018 8:00
171/1/2018 9:00
181/1/2018 10:00
191/1/2018 11:00
201/1/2018 12:00
211/1/2018 13:00
221/1/2018 14:00
231/1/2018 15:00
241/1/2018 16:00
251/1/2018 17:00
261/1/2018 18:00
271/1/2018 19:00
281/1/2018 20:00
291/1/2018 21:00
301/1/2018 22:00
311/1/2018 23:00
321/2/2018 0:00
Sheet1
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I got this to work for me. Using Conditional Formatting when the MOD of the Date Value is 1. It needs to be a date or a regular value as the TIME function resets to 0 at midnight.
THe conditional formatting for midnight is [hh]:mm and all other times hh:mm.

Cell Formulas
RangeFormula
A3A3=0+TODAY()-INT(TODAY())
B3:B28B3=MOD(A3,1)
A4:A28A4=A3+1/24
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:A28Expression=MOD(A3,1)<>1textNO
A3:A28Expression=MOD(A3,1)textNO
 
Upvote 0
Another option: display the desired date/time as text using the following formula:
Excel Formula:
=IF(MOD(ROUND(I8,5),1),TEXT(I8,"m/d/yyyy h:mm"),TEXT(I8-0.01,"m/d/yyyy")&" 24:00")
Note: these text strings can be used in calculations -- Excel will convert them into real date/time values.
 
Upvote 0
Tetra thank you! That worked a little easier. Very much appreciated!
 
Upvote 0

Forum statistics

Threads
1,215,072
Messages
6,122,966
Members
449,094
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top