custom time format - 12 hr without am/pm

istril

Board Regular
Joined
Aug 15, 2008
Messages
109
I'd like my times to display as h:mm, but on a 12 hour format, WITHOUT the AM or PM trailing it. I fooled around with the custom time formats, but I'm having trouble doing this without it getting converted to military time.
 
Shucks, I am trying to write train schedules and need the cell size to be minimized so i can fit tons of info on one page.
You can save a little bit of extra space (the width of the letter M) by Custom Formatting the cells using this type pattern...

h:mm a/p

for the format pattern (make sure to use a small "a" and "m"). First, though, you might need to clear the existing format as I had trouble imposing this new format on top of the one that was already there (the a/p seemed to conflict with the existing AM/PM). Don't forget to put the Line Feed character (CTRL+J) back (in front of, not behind, the space).


EDIT NOTE
------------------------
I just noticed that you can remove the space (and save a little bit more room) as the Line Feed (CTRL+J) character works in place of the space! The overall saving in the width of the cell was 19 pixels on my monitor.
 
Last edited:
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
01:00100
02:00200
problem statement - make 18:00 typed in as 18:00 appear as 60003:00300
04:00400
timetable for typing05:00500
06:00600
18:0007:00700
08:00800
09:00900
10:001000
11:001100
12:001200
13:00100
timetable for actual use14:00200
15:00300
60016:00400
17:00500
=VLOOKUP($E$8,mytable,2)18:00600
19:00700
20:00800
21:00900
22:001000
23:001100
00:001200
you could make a table from 00:01 to 23:59
and define thus how you want any time to display
00:19 would be 019 I guess
the above table is named mytable

<colgroup><col width="64" span="18" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Rick - I sometimes state what the problem is imho where there is some lack of clarity. I only joined in when I saw the incredible number of views.
 
Upvote 0
I understood OP was making a timetable so 130 as text is acceptable and 130 can be used as either am or pm since the timetable provides the context.............
 
Upvote 0
Sorry. I can't get my cell formula to display after the less than sign. I'll try putting the less than sign in quotes. Of course if the quotes display, you do not need the quotes around the actual less than sign:

IF(A1"<"TIME(13,0,0),A1,A1-TIME(12,0,0)).
dkmahan this is the best and most awesomestest solution.

GOOD SHOW!
 
Upvote 0
Hi istril

There is no number format that can directly diplay 18:00 as 6:00, they are not, in fact, the same time.

You'll have to find some workaround that may suit you. For ex., 2 options:

1 -use in another cell a formula, like

=SUBSTITUTE(SUBSTITUTE(TEXT(A1,"h:mmAM/PM"),"AM",""),"PM","")

Notice that the result in the cell is a string, not a time value, and you lose the information if it is am/pm

2 - hide the am/pm part in a second line

You can format the cell with a format this way.´

In the Custom Format write

. h:mmAM/PM
. position the cursor between the h:mm and the AM/PM
. press CTRL-J

Format the cell with wrap text
This format sends the AM/PM part to a second line. By keeping the default row height, this second line is not visible and so it's like you have the format you wanted.

Notice that in this case you still have the time value in the cell, you lost no information.
Great answer! Thank you. Option 2 worked great for my needs. Keeping the information as a time value is very handy.
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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