To determine if a time is AM or PM, use the following formula:
Formula:
=IF(A1=TIME(12,0,0),"PM","AM")
Here,
A1 is the cell containing the time you want to check. The
TIME function is used to specify the time 12:00 PM, and the
IF function checks if the time in A1 is greater than or equal to 12:00 PM. If it is, the formula returns "
PM", otherwise it returns "
AM".
Make sure that the cell containing the time is formatted as a time value, otherwise the formula may not work correctly. To format a cell as a time value, select the cell and go to the
Home tab, click on the
Number Format dropdown, and select "
Time" from the list.