We help IT Professionals succeed at work.

Difference between 2 different times.

spudmcc
spudmcc asked
Hi Experts

I need some help from you tonight.  I have 2 columns of times.  I need to calculate the difference between the two.  These are NOT start time and end time but rather
stop times by day for 2019 verses 2020.  So it could be positive or negative.  


                                                                      2019        2020

Monday                12/31/2018      12/30/2019      02:50      01:15
Tuesday               1/1/2019      12/31/2019      03:40      02:30
Wednesday      1/2/2019      1/1/2020      03:05      02:55
Thursday      1/3/2019      1/2/2020      03:10      03:05
Friday               1/4/2019      1/3/2020      02:30      02:40
Saturday      1/5/2019      1/4/2020      02:55      03:45
Sunday              1/6/2019      1/5/2020      02:35      02:30

Any help would be appreciated.  I have spend a couple hours trying everything that I could come up with and nothing.

Andy
Comment
Watch Question

can you give an example of expected results for a few of those rows?

Author

Commented:
2019      2020      
Monday                12/31/2018      12/30/2019      02:50      01:15      95 minutes
Tuesday               1/1/2019      12/31/2019      03:40      02:30      70 minutes
Wednesday      1/2/2019      1/1/2020      03:05      02:55      10 minutes
Thursday      1/3/2019      1/2/2020      03:10      03:05      5 minutes
Friday              1/4/2019      1/3/2020      02:30      02:40      minus 10 minutes
Saturday      1/5/2019      1/4/2020      02:55      03:45      minus 50 minutes
Sunday              1/6/2019      1/5/2020      02:35      02:30      5 minutes

I prefer everything to me in minutes.  It will be minus if last year beat this years time.
Top Expert 2014
I don't see your dates aligning on the same row.  For instance, 12/31/2018 is not equal to 12/30/2019.

Author

Commented:
I don't care about the date.  That should not factor into any solution.  I only care about the two time elements on each line.  The difference in minutes between the 2 times.
Top Expert 2014
The DateDiff() function should work.

Also, you might be able to directly subtract the two times and multiply by 1440 (the number of minutes in a day).
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

If 2019 times are in column D and 2020 times are in column E, try this...


=(D2-E2)*1440

And set the format of the formula cells as General.

Author

Commented:
thank you experts.  This solved my issue.
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

You're welcome! Glad we could help.