+ Reply to Thread
Results 1 to 15 of 15

Summing Military Times

  1. #1
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Summing Military Times

    I'm working on a sum formula for military times.
    The data is imported from an external software package.
    I highlight all times in Column D and choose "more number formats" and format all cells in column D to h:mm:ss
    I then want to sum Column D to total time worked, I just get Zeroes.

    Any ideas? Sheet attached
    Attached Files Attached Files
    Last edited by echomakr1; 06-07-2019 at 10:48 AM.

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Summing Military Times

    Try this:

    =SUMPRODUCT((D2:D125)+0)

    Then format as [h]:mm:ss

  3. #3
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Quote Originally Posted by 63falcondude View Post
    Try this:

    =SUMPRODUCT((D2:D125)+0)

    Then format as [h]:mm:ss
    Solved, you are fantastic, thanks! Can you briefly explain this, if you don't mind. I'd like to understand what you're doing here. Marked thread as SOLVED.

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Summing Military Times

    Happy to help.

    You can select the cell that the formula is in and then go to Formulas > Evaluate Formula

    The formula adds 0 to D2 then adds 0 to D3, ... , then adds 0 to D125 and adds up all of the results.

    We add 0 to change from text to a number.

    Edit: Thanks for the rep!
    Last edited by 63falcondude; 06-07-2019 at 11:18 AM.

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Summing Military Times

    Or this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Summing Military Times

    It appears that your text format times are causing you numerous problems.

    If you only need to refer to the time differences in D2:D125 with formulas, then simply entering =C2-B2 into D2, then filling down will give you valid times to work with, solving all of your formula problems.

    If you need other formulas to refer to the date / time values in colunn B and C as well, then try this little trick.

    Select a single empty cell (any one). Press Ctrl + c to copy it.
    Select B2:D125
    Press Ctrl Alt v, v, d, enter.

    Doing this should convert any numeric values formated as text (this includes dates and times), to proper numeric values.

    You may need to re-format columns B and C as mm/dd/yyyy hh:mm:ss after doing this.

    Once you have done this, you should be able to use any formulas that you need to without trying to get a valid time from text in each one.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Summing Military Times

    Or select the column, do Data > Text to columns, Finish, and then just use a normal SUM formula.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Quote Originally Posted by AlKey View Post
    Or this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Works beautifully, thanks!!

  9. #9
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Excellent advice, many thanks!

  10. #10
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Quote Originally Posted by jason.b75 View Post
    It appears that your text format times are causing you numerous problems.

    If you only need to refer to the time differences in D2:D125 with formulas, then simply entering =C2-B2 into D2, then filling down will give you valid times to work with, solving all of your formula problems.

    If you need other formulas to refer to the date / time values in colunn B and C as well, then try this little trick.

    Select a single empty cell (any one). Press Ctrl + c to copy it.
    Select B2:D125
    Press Ctrl Alt v, v, d, enter.

    Doing this should convert any numeric values formated as text (this includes dates and times), to proper numeric values.

    You may need to re-format columns B and C as mm/dd/yyyy hh:mm:ss after doing this.

    Once you have done this, you should be able to use any formulas that you need to without trying to get a valid time from text in each one.
    Excellent advice, many thanks!

  11. #11
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Quote Originally Posted by shg View Post
    Or select the column, do Data > Text to columns, Finish, and then just use a normal SUM formula.
    Very clean, works great. Thanks!

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Summing Military Times

    You're welcome!

    Shg has suggested an alternative way to achieve the same in post #7, however that one will only work with cells that contain either a date or a time, not both. see edit.

    Shg's suggestion has the advantage of being able to work with foreign date formats if needed, whilst mine will only work with dates that match the format of your regional settings.

    Either way, both are handy to remember if you will be working regularly with imported data that has numeric values in text formats.

    edit:- Text to columns didn't appear to work when I tried it, which is why I suggested the alternative. Looking at it closer, that also appears to be related to regional settings. It fails for me with dates where the day is greater than 12, this implies that changing the dropdown to MDY has no effect when there is a combined date and time and that excel is still trying to convert it in DMY format as per my settings.

    If this is the case, then I would imagine that it will work fine for you as the dates are in your local format.

    Text to columns, 1 column at a time.

    Copy and paste special, any number of rows / columns.
    Last edited by jason.b75; 06-07-2019 at 11:48 AM.

  13. #13
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Quote Originally Posted by jason.b75 View Post
    You're welcome!

    Shg has suggested an alternative way to achieve the same in post #7, however that one will only work with cells that contain either a date or a time, not both.

    Shg's suggestion has the advantage of being able to work with foreign date formats if needed, whilst mine will only work with dates that match the format of your regional settings.

    Either way, both are handy to remember if you will be working regularly with imported data that has numeric values in text formats.
    Ahh, great info, thanks for the follow up!

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Summing Military Times

    Please refresh the page and take another look at my last reply. I tried it again just to make sure that I hadn't made a mistake when I tried it earlier, and noticed an anomaly, so I've edited my earlier reply to reflect this.

  15. #15
    Registered User
    Join Date
    06-07-2019
    Location
    Texas
    MS-Off Ver
    2013
    Posts
    15

    Re: Summing Military Times

    Quote Originally Posted by jason.b75 View Post
    Please refresh the page and take another look at my last reply. I tried it again just to make sure that I hadn't made a mistake when I tried it earlier, and noticed an anomaly, so I've edited my earlier reply to reflect this.
    Noted, thank you sir.

+ 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. Summing military time is not producing desired result in a specific cell
    By seanpod in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-11-2015, 11:15 AM
  2. Summing a row of hours set in military time
    By sandk0330 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2014, 04:19 PM
  3. Formula for difference between military times
    By bunty_1244 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-11-2013, 01:10 PM
  4. [SOLVED] How do you end military times in column to 'total minutes'
    By bustech in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-15-2013, 01:35 PM
  5. change times to military time
    By sk81681 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2008, 03:36 AM
  6. military times come up 0:00
    By me1258 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-26-2007, 03:20 PM
  7. Converting military times to numbers
    By Wire323 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2006, 04:06 AM

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