• Time and date formula

    Author
    Topic
    #462680

    Good morning

    Can somebody help me with a formula please. I have 4 columns collection date dd/mm/yy (d1), collection time hh.mm (e1) and then the same format in f1 and g1 for delivery date and delivery time. I need to work out for about 43,000 records what the transit time was. The date columns are in date format and the collect / delivery times in number format.

    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #1178409

      For row 1, use the formula

      =F1-D1+(INT(G1)+MOD(G1,1)/0.6-INT(E1)-MOD(E1,1)/0.6)/24

      Format it with the time format of your preference, for example [h]:mm, then fill down.

      (It would have been better if you had used time format instead of number format for the times.)

      • #1178651

        For row 1, use the formula

        =F1-D1+(INT(G1)+MOD(G1,1)/0.6-INT(E1)-MOD(E1,1)/0.6)/24

        Format it with the time format of your preference, for example [h]:mm, then fill down.

        (It would have been better if you had used time format instead of number format for the times.)

        Hi Hans

        Thank you for your input on this, I have b een desperately trying to get this to work but cannot, I have attached a simple cut down example that should now have the date and times in the correct format, any help will be greatly appreciated.

        • #1178655

          This time, columns E and G contain proper time values, but columns D and F don’t contain date values but text strings. 24.02.09 is not a valid date unless your system settings use a point as date separator (such as in Germany).
          Please enter the dates in a format that your system settings recognize, such as 24/02/09 or 24-Feb-09.

      • #1186554

        For row 1, use the formula

        =F1-D1+(INT(G1)+MOD(G1,1)/0.6-INT(E1)-MOD(E1,1)/0.6)/24

        Format it with the time format of your preference, for example [h]:mm, then fill down.

        (It would have been better if you had used time format instead of number format for the times.)

        Hi Hans

        Sorry to bother you with this again but I seem to be getting some inaccurate results

        Column D is the start date and formatted dd/mm/yyy in the date format
        Column F is the end date and is formatted as above
        Column E is the start time and formatted as hh.mm.ss in the time format
        Column G is the end date and formatted as above

        So for example I have

        08/10/2009- 11:38:00- 12/10/2009- 11:38:00- in row 42 and the formula in H42 is

        =F42-D42+(INT(G42)+MOD(G42,1)/0.6-INT(E42)-MOD(E42,1)/0.6)/24

        But it returns 00:00:00

        Is it possible that you could identify from this information what I have done wrong?

        • #1186558

          The time difference is 96 hours, but Excel by default displays clock time which doesn’t go above 24 hours.
          Apply the custom format [h]:mm:ss to the cells in column H. The [h] specifies cumulative time.

          • #1186565

            The time difference is 96 hours, but Excel by default displays clock time which doesn’t go above 24 hours.
            Apply the custom format [h]:mm:ss to the cells in column H. The [h] specifies cumulative time.

            Thanks as usual Hans

            The help files never seem to tell you these things, anyway I cheated and copied and pasted the data into the example you had sent me before and it worked 🙂

            Ta

    • #1178659

      Thanks for the quick repsonse Hans

      I have 30,000+ rows, what would you suggest is the easiest way of changing the format short of manually

      • #1178660

        Replace . with / in the date columns.

        You’ll have to modify the formulas because the data now look differently from what you originally made us believe.

        See the attached version.

        • #1178683

          Replace . with / in the date columns.

          You’ll have to modify the formulas because the data now look differently from what you originally made us believe.

          See the attached version.

          Terrific Hans

          Thanks so much

          I struggled for a while because I could not see for the life of me how I was going to change 122,210 . (periods) with a / but after some thought decided to highlight the 2 sets of data, cross my fingers, and do a find . and replace / and it worked,phew

          Have a good weekend

    Viewing 1 reply thread
    Reply To: Time and date formula

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: