Tom’s Tutorials For Excel: Verifying a Time as AM or PM
Here’s how you can verify a cell’s time value as either morning (AM), or afternoon or evening (PM). This is useful if you encounter a cell whose formatting does not show the time itself, such as in the pictured example below.
The formula in cell B2 is =IF(MOD(A2,1)>=0.5,"PM","AM")
.
The “>0.5
” portion of the formula sets the condition of the half-day mark, that being 12:00 noon, which separates the AM and PM halves of the 24-hour day.
Many Thanks
Thanks for this – an eloquent and simple solution!
…but 12:00:00 PM is then given as “AM”!
Thanks. I just edited the page to show the formula as
=IF(MOD(A2,1)>=0.5,"PM","AM")
Thank you so much. Helped me big time.
Thanks, Chip!
A more intuitive alternative is `=TIMEVALUE()`.
TIMEVALUE(00:00) = 0
TIMEVALUE(06:00) = 0.25
TIMEVALUE(12:00) = 0.5
TIMEVALUE(18:00) = 0.75
Therefore, =IF(TIMEVALUE(A1)>=0.5,”PM”,”AM”)