Show AM PM Not Military Time

steve the excel guy

Board Regular
Joined
Aug 28, 2007
Messages
104
Hi all,
I melted my eyes and brain reading through pages in this forum referring to TIME.

In short, I don't want to type Military Time. I tried to create a formula to show PM if the time is greater than 12:00 or AM if it is less as follows:

Code:
=IF(K4>"12:00"," PM"," AM")

This returns "AM" no matter what time is placed in K4... even if Military time were entered. So I changed it to a "<" sign. Now, it returns a "PM" no matter what.

I even converted it to:

Code:
IF(TEXT(K4>"12:00","hh:mm")," PM"," AM")

Same output.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
did you try formatting the cell?

ctrl +1 > Time > 1:30PM
 
Upvote 0
If your cell values are true times, this is a matter of formatting.

Take a cell, hit Control + ~, and let me know what is actually in the cell...(this puts it into General formatting, or basically, no formatting).

Regards.
 
Upvote 0
I'm not sure what you mean, if you mean a custom format using what you typed, it won't allow me to enter that.

I should also mention that the formula I showed below is within a concatenate formula so it will show something like "I called John at 11:30 AM".

Code:
=concatenate("I called John at "&IF(K4>"12:00"," PM"," AM"))
 
Upvote 0
If your cell values are true times, this is a matter of formatting.

Take a cell, hit Control + ~, and let me know what is actually in the cell...(this puts it into General formatting, or basically, no formatting).

Regards.

lol... after I made the last response, I saw your statement. I tried the Control ~ anyway and it put the entire page into general formatting and UNDO won't fix it. DANG IT!
UPDATE: Hitting Control ~ again fixes it.

But to answer your question. K4 shows 0.45833333333 but if you click in it, it shows 11:00:00 AM
 
Upvote 0
give this a try

=CONCATENATE("I called John at "&IF(HOUR(K4)>=12,IF(HOUR(K4)=12,TEXT(K4,"hh:mm")&" PM",TEXT(K4-TIME(12,0,0),"hh:mm")&" PM"),IF(HOUR(K4)=0,TEXT(K4+TIME(12,0,0),"hh:mm")&" AM",TEXT(K4,"hh:mm")&" AM")))
 
Upvote 0
Wow! That's a mouthful (so to speak). It works. I didn't imagine it would be such a long code for such a simple adjustment, lol.

Thank you very much!
 
Upvote 0
I was thinking if you have real times (appears you do), it is actually easier - just use a time format, i.e,:

In Cell A1: .458333
In Cell B1: ="Called John at "&TEXT(A1,"h:mm AM/PM")

Note:
See Excel help under Guidelines for Custom Number Formats for more detail on time formats - with the TEXT() formula we just put the format in quotes as the second argument.
 
Last edited:
Upvote 0
Sure, if you want to do it the easy way! Hahaha... Ok... I guess all I need to know was to add the AM/PM part in it. And I guess I didn't need the "concatenate" either.
 
Upvote 0

Forum statistics

Threads
1,215,650
Messages
6,126,019
Members
449,280
Latest member
Miahr

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