subtracting values only after a change

dmheller

Board Regular
Joined
May 26, 2017
Messages
142
Office Version
  1. 365
I have included some data but on 3/30/22, i had to hard type the value but i have an equation in where the value 66 and 78 are and it is very bad. It looks at column B and C and D and E those are hours and min and then tries to look for a change. It only looks 4 days down and i could write it longer but is there a better way to find the change and then show the difference? So you can see 3/24/22 to 3/28/22 the change is 60 minutes and 49 minutes. then from 3/28/22 to 3/30/22 change was 66 and 56 minutes then my equation didnt work for 3/30/22 because it was a 5 day gap so i hard typed that in and put a new value in 4/4/22. It is a mess but any help would be great.
thanks.
=IF(C90="","",IF((C89*60+D89)=(C88*60+D88),0,IF(AND((C89*60+D89)=(C90*60+D90),(C89*60+D89)=(C91*60+D91),(C89*60+D89)=(C92*60+D92),((C93*60+D93)-(C89*60+D89))>0),(C93*60+D93)-(C89*60+D89),IF(AND((C89*60+D89)=(C90*60+D90),(C89*60+D89)=(C91*60+D91),((C92*60+D92)-(C89*60+D89))>0),(C92*60+D92)-(C89*60+D89),IF(AND((C89*60+D89)=(C90*60+D90),((C91*60+D91)-(C89*60+D89))>0),(C91*60+D91)-(C89*60+D89),IF(((C90*60+D90)-(C89*60+D89))>0,(C90*60+D90)-(C89*60+D89),0))))))

3/24/2022​
396​
43​
367​
41​
60​
49​
2340​
1911​
4251​
3/25/2022​
396​
43​
367​
41​
0​
0​
0​
0​
0​
3/26/2022​
396​
43​
367​
41​
0​
0​
0​
0​
0​
3/27/2022​
396​
43​
367​
41​
0​
0​
0​
0​
0​
3/28/2022​
397​
43​
368​
30​
66​
56​
2574​
2184​
4758​
3/29/2022​
397​
43​
368​
30​
0​
0​
0​
0​
0​
3/30/2022​
398​
49​
369​
26​
78​
72​
3042​
2808​
5850​
3/31/2022​
398​
49​
369​
26​
0​
0​
0​
0​
0​
4/1/2022​
398​
49​
369​
26​
0​
0​
0​
0​
0​
4/2/2022​
398​
49​
369​
26​
0​
0​
0​
0​
0​
4/3/2022​
398​
49​
369​
26​
0​
0​
0​
0​
0​
4/4/2022​
400​
7​
370​
38​
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
sorry there is an edit that needs to be mentioned. it is not column b and c then d and e, the equation reflects the columns the times are in. they are in C and D then there is the same equation for E and F.
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,794
Members
449,468
Latest member
AGreen17

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