+ Reply to Thread
Results 1 to 14 of 14

convert time without am pm to 24 hour

  1. #1
    Registered User
    Join Date
    12-01-2015
    Location
    ballarat
    MS-Off Ver
    2013
    Posts
    85

    convert time without am pm to 24 hour

    hello,
    Hoping someone may be able to help.I download from a site data which has times in the format as per sample sheet col A.I would like to be able to automatically change it to 24 hour time as per col B.They do not put am or pm next to it.This I imagine would only create a problem if there were, for example morning times 10:30am and evening times 10:30pm without having am or pm.However in my case the earliest times at this stage appear to be
    Starting in the morning 10:30am with the
    latest start 10:00pm at night
    So I would like up until 1pm to remain the same as in ColA e.g 10:30,11:45 then when it becomes 1:00 to change to 24 hour becoming 13:00.The 10PM at night would be then 22:00.
    Attached Files Attached Files

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: convert time without am pm to 24 hour

    All the times in Column A are AM times except for cell A2. How do you know that they should be PM? ie. 12+ in 24 hour time.

  3. #3
    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: convert time without am pm to 24 hour

    In the real dataset, is there also a date column?
    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.

  4. #4
    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: convert time without am pm to 24 hour

    With a date column:

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    1
    2
    2019-01-15
    11:30
    11:30
    11:30
    3
    2019-01-15
    12:30
    12:30
    12:30
    4
    2019-01-15
    2:25
    14:25
    14:25
    5
    2019-01-15
    2:25
    14:25
    14:25
    6
    2019-01-15
    3:25
    15:25
    15:25
    7
    2019-01-15
    5:15
    17:15
    17:15
    8
    2019-01-15
    5:45
    17:45
    17:45
    9
    2019-01-15
    6:15
    18:15
    18:15
    10
    2019-01-15
    7:15
    19:15
    19:15
    11
    2019-01-15
    7:45
    19:45
    19:45
    12
    2019-01-15
    7:45
    19:45
    19:45
    13
    2019-01-15
    10:00
    22:00
    22:00
    14
    2019-01-16
    11:30
    11:30
    15
    2019-01-16
    12:30
    12:30
    16
    2019-01-16
    2:25
    14:25
    17
    2019-01-16
    2:25
    14:25
    18
    2019-01-16
    3:25
    15:25
    19
    2019-01-16
    5:15
    17:15
    20
    2019-01-16
    5:45
    17:45
    21
    2019-01-16
    6:15
    18:15
    22
    2019-01-16
    7:15
    19:15
    23
    2019-01-16
    7:45
    19:45
    24
    2019-01-16
    7:45
    19:45
    25
    2019-01-16
    10:00
    22:00
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    E
    2
    =IF(COUNTIFS(B$1:B2,">"&B2,A$1:A2,A2)=0,B2,B2+0.5)
    Sheet: Sheet1
    Last edited by AliGW; 01-15-2019 at 02:21 AM.

  5. #5
    Registered User
    Join Date
    12-01-2015
    Location
    ballarat
    MS-Off Ver
    2013
    Posts
    85

    Re: convert time without am pm to 24 hour

    Hello,
    Thankyou both for replies.
    @ kersplash They are for a sporting event and I know they start in the morning and go through til early evening.

    @AliGW There is no date in the original data, it is downloaded each day in ColA as required by me.Your results in Col E 2:13 is what I would like to see in Col B

  6. #6
    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: convert time without am pm to 24 hour

    OK, then in C1 copied down:

    =IF(COUNTIF(A$1:A1,">"&A1)=0,A1,A1+0.5)

  7. #7
    Registered User
    Join Date
    12-01-2015
    Location
    ballarat
    MS-Off Ver
    2013
    Posts
    85

    Re: convert time without am pm to 24 hour

    Hello AliGW,
    Thank you for taking the time to provide me with a solution to my query.This is exactly what I require.
    THanks once again,

    Gil

  8. #8
    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: convert time without am pm to 24 hour

    No problem!

  9. #9
    Registered User
    Join Date
    12-01-2015
    Location
    ballarat
    MS-Off Ver
    2013
    Posts
    85

    Re: convert time without am pm to 24 hour

    Sorry to open again but I have downloaded from new area and I cannot get the formula to work.
    The sheet is how I download it just copied and pasted into excel without any preformatting.
    Attached Files Attached Files

  10. #10
    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: convert time without am pm to 24 hour

    You still have the thread marked as solved - remove the solved tag for now if you want further help.

    The values are not time values - they are just text (set as general format).
    Last edited by AliGW; 01-17-2019 at 01:54 AM.

  11. #11
    Registered User
    Join Date
    12-01-2015
    Location
    ballarat
    MS-Off Ver
    2013
    Posts
    85

    Re: convert time without am pm to 24 hour

    Hello AliGW,
    I was not sure how to proceed with this,thank you.I have changed the format to time but still cannot get this to work in this case.
    Attached Files Attached Files

  12. #12
    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: convert time without am pm to 24 hour

    That's because the sample data you gave us before included AM times - this appears not to, so there's no way for Excel to determine which, if any of these times is meant to be PM. Excel is no more clairvoyant than I am.

  13. #13
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: convert time without am pm to 24 hour

    Click on column A, then on Data | Text-to-columns then click Finish, and those times will be converted from text to numerical times. You will need to format the cells in column B as Time in the style you prefer.

    Hope this helps.

    Pete

  14. #14
    Registered User
    Join Date
    12-01-2015
    Location
    ballarat
    MS-Off Ver
    2013
    Posts
    85

    Re: convert time without am pm to 24 hour

    Hello,
    Thanks everyone for your contributions.

+ 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. convert time to 24 hour
    By gilnic in forum Excel General
    Replies: 11
    Last Post: 02-08-2019, 02:52 AM
  2. Convert 24 hour time to decimal
    By LaurieH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2015, 04:33 AM
  3. VBA to convert 12 hour to 24 hour time
    By Krrattner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2012, 06:59 PM
  4. Convert 12 hour to 24 hour time
    By RussellNonBrand in forum Excel General
    Replies: 5
    Last Post: 01-26-2011, 03:01 PM
  5. Replies: 5
    Last Post: 06-28-2006, 02:20 PM
  6. [SOLVED] Convert Date/Time to the Hour
    By eric_rs1 in forum Excel General
    Replies: 2
    Last Post: 10-03-2005, 12:05 PM
  7. [SOLVED] Convert decimal hour into time format?
    By ramdalen in forum Excel General
    Replies: 2
    Last Post: 06-20-2005, 02:05 PM

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