![]() |
Function to determine if AM or PM
I have some times that I need a separate cell to look at that time and
tell me if it is AM or PM. I tried using the Right(A1,2) but that did not work even though I see the PM in the input bar. I also tried if(A112:00,"PM","AM") but that did not work either. Any help would be appreciated. |
Answer: Function to determine if AM or PM
To determine if a time is AM or PM, use the following formula:
Formula:
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. |
Function to determine if AM or PM
=IF(A10.5,"PM","AM")
Works if there is only time in A1, not a date too. You can check by formatting A1 (temporarily) as general; it should be less than 1. If there is a date part: =IF(MOD(A1,1)0.5,"PM","AM") -- Kind regards, Niek Otten Microsoft MVP - Excel "gtslabs" wrote in message ... |I have some times that I need a separate cell to look at that time and | tell me if it is AM or PM. I tried using the Right(A1,2) but that did | not work even though I see the PM in the input bar. I also tried | if(A112:00,"PM","AM") but that did not work either. Any help would | be appreciated. |
Function to determine if AM or PM
Try this with the time in cell A1:
=IF(A1=0.5,"PM","AM") HTH, Paul -- "gtslabs" wrote in message ... I have some times that I need a separate cell to look at that time and tell me if it is AM or PM. I tried using the Right(A1,2) but that did not work even though I see the PM in the input bar. I also tried if(A112:00,"PM","AM") but that did not work either. Any help would be appreciated. |
All times are GMT +1. The time now is 06:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com