+ Reply to Thread
Results 1 to 22 of 22

Display times in a 12-hour format without the AM or PM displayed in the cell

  1. #1
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Display times in a 12-hour format without the AM or PM displayed in the cell

    I've tried many different custom formats, but can't get 12 hour time to display without the AM or PM displayed in the cell. Perhaps if there isn't a custom time format to accomplish this, an IF formula could be used. I've tried to figure out how that could be accomplished but don't understand enough about IF functions yet, but here's my attempt at an explanation of what I imagine an IF formula could do.

    IF C4 =13:00 then -12:00 (this would bring the time display to 1:00) I would then copy down that formula.

    Now, if the IF formula is the best solution, could the cells in the time display column contain the time plus the IF formula?, or would I need to create an additional time column that I would feed off but hide when I have the page developed?

    My goal here is to keep the time column as narrow as possible to leave more room to write in the adjacent cell, while still seeing all days on the calendar page.

    Also, for the "Start" time to be easily customizable, all a person needs to do is change the first time on Monday (let's say from 5am to 6am), and all times automatically update.

    The file I've included does this now, but as mentioned, all time are 24 hours, and I want them in 12 hour format.

    I've also included an extra column on the left if the IF formula is the way to go here.

    Any help would be greatly appreciated.

    Thanks,
    Bryan
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Excel won't let you display 12-hour times without am/pm, so you'll have to use the IF method. Use this in C4, dragged down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This will subtract 12 hours (0.5 of a day) from 1pm (13:00) or later. The reason for using 13:00 is to allow 12:30 pm (half-past noon) to display as 12:30 not 0:30.
    You can then hide column B.
    Since column B is hidden, you may with to have another cell in which the user can change the start time, then refer to that cell in B4 itself.

    I've attached your file, amended as above. Hope that helps.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Brilliant! You did an excellent job. Would have taken me a long while to figure out that IF formula, and I really liked how you inserted the start time cell (very thoughtful), labeled and highlighted it nicely, and provided a succinct but complete explanation of what you did and how. Also, thoughtful re the 12:30 time vs 00:30. Thank you so much Ardigspook! Made my day!
    Bryan
    Last edited by BryanHCR; 08-18-2019 at 12:40 PM.

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    I would probably go with Aardigspook's formula, but I just wanted to show you there is almost always more than one way to do anything in Excel...

    =MOD(A1-0.01,0.5)+0.01

  5. #5
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    @Bryan: You're welcome, glad I could help and thanks for the rep.

    @Rick: You're quite right that there are often many ways of doing something in Excel, but note that using MOD will make 12:30 pm display as 0:30.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Quote Originally Posted by Aardigspook View Post
    @Rick: You're quite right that there are often many ways of doing something in Excel, but note that using MOD will make 12:30 pm display as 0:30.
    Bad testing on my part. This should work correctly though...

    =MOD(A1-1/24,0.5)+1/24

  7. #7
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Hi Rick,
    Thanks for taking the time to provide another solution. I appreciated that. I didn't know about the MOD Function, so I'll look into it further. Always good to learn!
    As well, for following up on Aardigspook's 0:30 comment. : )

  8. #8
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Thanks again Aardigspook, I have an inquiry for you if you are in the mood.

    I've attached another spreadsheet to the workbook that has the calendar file you modified for me. The included spreadsheet is part of a completed finance workbook that I received a lot of help from forum members to create, so I don't understand how everything is working, but at this point, it's just important that it does work!

    I referrered to the spreadsheet I'm including when trying to figure out how an IF formula might work for the time format problem that you have now solved. What I'm wondering about is this: You will see an IF formula in the months columns of the included spreadsheet. So, I'm wondering how it is that the column is displaying the actual number of months, even though it has the IF formula in it. I can't see/remember how this was accomplished. I'm wondering (since this is possible) if it is also possible to display the times in the calendar spreadsheet as well as the IF function in just one column.

    There would be some advantages to this, for example, it would make it a little "tidier" to allow each day of the week to have a different start time without each day having a hidden column.

    The spreadsheet I gleaned this from has 15 creditor columns, but I just included Creditor 1 since it's all that's needed for my inquiry.
    Attached Images Attached Images
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Hi Rick,
    I wanted to let you know that your 2nd MOD formula solution is actually the one I'm using. The reason is this: When I changed the start time on the calender to 7:00 (for example), the 2nd time the 13:00 appeared, it did not convert to 12:00 using Aardigspook formula for some reason, which is the reason I tried yours. So, thanks, your extra effort is much appreciated!

    Perhaps you wouldn't mind taking a look at a reply I sent to Aardigspook re an (additional) inquiry about the possibility of having the time and formula in the same cell. I included a file that shows where I show the days of the month, that also includes an IF formula, but, as explained, I had help from forum members to do this and I can't remember or figure out how it works.

  10. #10
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    I'm glad Rick's formula worked for you - I hadn't noted that you might want the end time to go beyond midnight (my bad).

    The IF formula in your other sheet works by counting the number of rows from row 8 (fixed) to row 8 (changes as the rows go down). So in row 8, it's 1 (just row 8); in row 9 it's 2 (rows 8 and 9); row 10 is 3 (rows 8, 9 and 10), etc. So it's not actually including the month number and formula in the same cell - the formula is giving what looks like the month number.

    If you want to get rid of the hidden column and enable a different start time for each day, then try this:
    • Create a 'start time' cell for each day (copy/paste of the one from Monday will work);
    • For Monday, put this in C4 (under the yellow start time):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    (this uses a similar 'count of rows' system as I explained above, to add 30 minutes to each subsequent row)

    • Drag it down as far as you need (or select C4 and then double-click the bottom-right corner, to have Excel auto-fill for you);
    • Copy and paste column C to the appropriate columns for the other days;
    • Delete the now-not-needed column B.

    As before, file attached with this working. Hope that helps.

  11. #11
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Wow, Aardigspook, thank you so much for the thorough explanation re my inquiry, and for the time you put into this. So appreciated! Also, for providing me with a working file. Just great. It's so interesting to me how the open and collaborative efforts are usually the ones that bring the best results.

    The singular columns are so helpful and allow for more adaptability.

    I was also wondering how you inserted those little arrows in the Start time cell, and was about to ask you and then decided to do a google search on how to do it. Found the answer so I now understand how to add the arrows with symbols. It's a nice touch and I appreciate learning that because of you.

    Hope you have a great day, and thank again!

  12. #12
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    You're very welcome, glad we could help.

    (Actually for the arrows and other symbols I use Alt-codes: press and hold the left-Alt key whilst typing the required number on the number keypad (not the numbers above qwerty). Alt-24 is ↑, Alt-25 is ↓, Alt-26 is →, Alt-27 is ←. The numbers needed can be found using 'Character Map' in Windows and I've memorised many of them over the years (sad, I know ). But Insert Symbol works just as well for common symbols.)

  13. #13
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Thanks for letting me know about Alt-codes and the Windows Character Map. That will come in handy. And memorizing such things is a good thing, faster and good brain exercise as well, so nothing "sad' about that .

    I noticed you are Forum Expert with just 2,184 posts, so I'm assuming you achieve such status through members adding 'reputation' is that correct? This must mean you've been very helpful to others in your responses. I'm mentioning this because I've noticed other forum Experts and Gurus have very high post numbers.

    Since you really seem to know your stuff, I was wondering if you know if it is possible to embed a cell style so that when you move that cell, the original cell maintains the same format style. I have been able to achieve this (in part) by highlighting an entire row of cells, then setting the style. For example the Routine Calendar I posted is like this, but it only works on one cell style, so adjacent columns or cells (for example) cannot be customized through (for example) highlighting an entire column and setting a different style. Of course it will set the style, but if the cells are moved, the style "goes with it". You will notice you can write and then move the entry cells on the Routine Calendar, and when you write again in the original cell, the original format has been maintained. But if you move a cell in a time column, the original style is "lost".

  14. #14
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Well, I stand corrected. I just test this again, and Excel does allow column custom cell styling as well as the row method I mentioned in my last post. This did not work on the Mac 2011 version, but it works on both the 2016 Windows and Mac versions. So there you go... Should have checked this more thoroughly before my last post...

  15. #15
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Closing Thought: You helped because I thought you could, and in my query to you ended up figuring it out to make sure my query was accurate, which I wouldn't of even tried if I didn't think you might have the answer...

  16. #16
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Hi Aardigspook,
    While working on the calendar form you helped me with I noticed something odd that I thought you might be interested in seeing. I'm sending back the file you sent me, wherein I thought the 1:00/13:00 display had been solved, and for the most part it has. But...when copying the formula over to a new spreadsheet calendar format, I noticed the 13:00 popping up. I thought I was doing something wrong, until I noticed that all start times didn't respond the same re the 1:00/13:00. So I looked more closely at the file you sent and I noticed the same thing, which you will see as well. I've highlighted where the 13:00 is popping up in some of the columns, and the strange thing is, even in the same column, 1:00 appears in the next 12 hour cycle after a 13:00. You will also notice I highlighted the 1:00 times on the 3rd day, where there is no problem, 1:00 appears in both 12 hour cycles. Basically, you will see that the formula isn't consistent, sometimes it display 1:00 sometimes 13:00, and as mentioned, this can happen in the same column. Any ideas on a fix?

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    You might wish to remove the SOLVED tag from the thread ...
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  18. #18
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Good point. Thanks. The SOLVED tag has been removed.

  19. #19
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Sorry, my fault . There was nothing wrong with Rick's basic formula, just with how I converted it to refer to a start time above instead of to a column to the left. I put the '-1/24' in the wrong place.

    Put this in C4 instead and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    As before, the file with it working is attached.
    My apologies again for the hassle.

  20. #20
    Registered User
    Join Date
    04-23-2019
    Location
    U.S.
    MS-Off Ver
    Excel 2016
    Posts
    70

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    Thanks Aardigspook for providing the remedy so promptly! It was also thoughtful of you to highlight all the 1:00s.
    I hope you have good day.
    Bryan

  21. #21
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    You're welcome, sorry that I didn't give you the correct version the first time!
    All the best,
    AS

  22. #22
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Display times in a 12-hour format without the AM or PM displayed in the cell

    In C4 then copy down

    =MAX(1/24,MOD(C3+(1/48),12.9/24))

    Apply for other ranges
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Show hours in 24 hour format between two times
    By Jay S. in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-19-2017, 03:15 PM
  2. Replies: 4
    Last Post: 12-04-2017, 05:22 PM
  3. Replies: 5
    Last Post: 03-18-2016, 01:39 PM
  4. Adding times that have text included in cell, e.g. 15 minutes + 1 hour
    By PMac4UA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-18-2013, 09:42 AM
  5. [SOLVED] Count number of times a specific colour is displayed in the cell
    By vignesh805 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2013, 04:45 AM
  6. Replies: 8
    Last Post: 08-15-2012, 11:36 AM
  7. Excel should be able to format 12-hour times without am/pm
    By Philip J. Rayment in forum Excel General
    Replies: 5
    Last Post: 01-31-2006, 06:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1