+ Reply to Thread
Results 1 to 9 of 9

Time calculation

  1. #1
    Registered User
    Join Date
    10-03-2015
    Location
    Northern, Alberta
    MS-Off Ver
    2016
    Posts
    50

    Time calculation

    Records Max 0:00
    640 Min 0:00:00

    Place Date/Time
    1 M1-T-Rifle - A 1 09/08/2016 08:10
    2 M1-T-Rifle - A 2 09/08/2016 08:27
    3 M1-T-Rifle - A 3 09/08/2016 07:58

    This is generated in 8.csv format. I then save it in 2016 Office Excel.

    I have 640 rows of data. I need to find the oldest TIME or MAX. And the youngest TIME or MIN. And subtract one from the other.

    I can't get any formatting to work. Can you help. Thanks

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Time calculation

    Use a helper column to get the date/time using:
    B1:
    Please Login or Register  to view this content.
    Get max in B1: =MAX(B:B)
    min in C: =MIN(B:B)
    then substract max - min
    Attached Files Attached Files
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    10-03-2015
    Location
    Northern, Alberta
    MS-Off Ver
    2016
    Posts
    50

    Re: Time calculation

    Place Date/Time
    09/08/2016 08:10
    09/08/2016 08:27
    09/08/2016 07:58

    This shows better the data in the column.

    I have 640 rows like this. So I put in a cell a formula "=MAX(B1:B640)"
    "=MIN(B1:B640)"

    Then a formula subtracting MIN from MAX to find the time lapse.

    Doesn't work.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Time calculation

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    10-03-2015
    Location
    Northern, Alberta
    MS-Off Ver
    2016
    Posts
    50

    Re: Time calculation

    I must be missing something simple.
    Attached Files Attached Files

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Time calculation

    Look like column B is imported from csv, displayed as date/time format. Try to add 0 to each cell to convert into real value by:
    Copy any blank cell (point to any blank cell, Ctrl-C)
    Choose B column (click on the column header to choose)
    Paste special/Operation/Add
    OK
    Quang PT

  7. #7
    Registered User
    Join Date
    03-07-2017
    Location
    High Wycombe, England
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Time calculation

    Could I suggest a simpler idea, particularly as you are imported data from a .csv file. All number calculations / data extracts will be in text, so you need to convert your data to an Excel Date number. I do this on a regular basis. Try inserting another column and add the following simple DATE Function with a TIME added on the end, i.e. if your first data value is in cell A2, try inserting in C2 =DATE(MID(A2,26,4),MID(A2,20,2),MID(A2,23,2))+RIGHT(A2,5). The syntax for the DATE Function is DATE(Year,Month,Day), so I assumed you had your data set in American "mm/dd/yyyy" date format rather than UK "dd/mm/yyyy". Hence, the DATE Function will extract a number, and the last element will add the decimal time value to the day value. Hey presto, you now have a number format that will allow you to conduct time calculations like MAX / MIN. Hope that helps, it works a dream for me. If in doubt, experiment with purely the MID Function for each value to prove that you can extract a TEXT value and convert it to a time function.

  8. #8
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,287

    Re: Time calculation

    I suggest two ways to solve.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-03-2015
    Location
    Northern, Alberta
    MS-Off Ver
    2016
    Posts
    50

    Re: Time calculation

    The Aggregate worked. The other returned a "#VALUE!

    I wonder if my Excel needs to be reinstalled. That being said I'm on Office 365. So it should be up to snuff. I got my original formulas to work on one download. But not on any others. So something went sideways in my formatting. I think. Thank you!!

+ 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. Replies: 2
    Last Post: 02-03-2017, 07:39 AM
  2. Budgeting out percentages of time from a time card calculation sheet
    By mhadaway in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-24-2015, 05:05 PM
  3. [SOLVED] Excel calculation for adding time and calculating remaining time
    By mark888 in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 01-12-2015, 12:55 PM
  4. [SOLVED] Excel calculation for adding time and calculating remaining time
    By mark888 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2015, 06:38 AM
  5. [SOLVED] Time entry on UserForm displaying inccorectly and calculation not working on the time.
    By Colin Smit in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2014, 01:21 PM
  6. Payroll time sheet calculation where time exceeds 24 hours
    By Rolo1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-23-2014, 08:57 AM
  7. Replies: 11
    Last Post: 05-20-2011, 02:09 PM

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