Return the Interval between two timings

mucah!t

Well-known Member
Joined
Jun 27, 2009
Messages
593
Hello all,

How do I calculate the interval between 2 decimal timings.

hours between 22.00 and 23.30 [cell A1-B1]
i.e: 15.00 - 01.00 = 01.50

The above is just an example. I like to be able to adjust the parameters when necessary. It also needs to take into consideration hours after midnight.

hours between 22.00 and 06.00 [cell A1-B1]
i.e: 15.00 - 01.00 = 03.00
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I can't make sense of either of your examples.

Maybe this:

Code:
      --A-- --B-- --C--
  1   22.00 23.30  1.30
  2   15.00  1.00 10.00
The formula in C1 and down is

=DOLLARFR(DOLLARDE(B1, 60) - DOLLARDE(A1,60), 60) + 24*(B1 < A1)<A1)< font>
 
Upvote 0
Hello shg,

In the first example the time in is 15.00 and the time out is 01.00
How much time falls between 22.00 and 23.30

Code:
A1 = 22.00 B1 = 23.30
A2 = 15.00 B2 = 01.00 C2 = 01.50
 
Upvote 0
Code:
      ---A--- ---B--- --C---
  1    22.00   23.30        
  2    15.00    1.00   1.30 
  3                         
  4                         
  5    22.00    6.00        
  6    15.00    1.00   3.00

C2: =DOLLARFR(MIN(DOLLARDE(B2, 60) + 24*(B2 < A2), DOLLARDE(B1, 60) + 24*(B1 < A1)) - MAX(DOLLARDE(A2, 60), DOLLARDE(A1, 60)), 60)


EDIT: That's a lot of clutter just to avoid entering times in standard fashion:

=MIN(B2 + (B2 < A2), B1 + (B1 < A1)) - MAX(A2, A1)
 
Last edited:
Upvote 0
Both of those should be wrapped in MAX:

=MAX(0, DOLLARFR(MIN(DOLLARDE(B2, 60) + 24*(B2 < A2), DOLLARDE(B1, 60) + 24*(B1 < A1)) - MAX(DOLLARDE(A2, 60), DOLLARDE(A1, 60)), 60))

=MAX(0, MIN(B2 + (B2 < A2), B1 + (B1 < A1)) - MAX(A2, A1))
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,794
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top