Time Difference If Statement

RayClarke

New Member
Joined
May 14, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am looking to calculate a time difference depending on the values in another column.
In the same way I can normally SumIF (if two values are the same) is there a way I can subtract IF?

In the example below, i want to find the difference between the 2 time stamps if the EventID is the same (i.e. how long the event lasted)
There will only ever be two identical eventID's, but they won't necessarily be one after the other on the sheet.

Line 38 All alarm list.xls
AB
1Date TimeEventID
22021-05-12 00:54:30{050A0E27-6095-4E71-9187-C6EFFC12C272}
32021-05-12 00:54:31{6E78EF9F-9294-4E5A-AA7E-D9360C0DBE54}
42021-05-12 00:54:40{6E78EF9F-9294-4E5A-AA7E-D9360C0DBE54}
52021-05-12 00:54:43{050A0E27-6095-4E71-9187-C6EFFC12C272}
62021-05-12 02:36:26{2D6FAD89-05BC-432E-9D66-C6ACDF596972}
72021-05-12 02:36:27{25D734D3-4F75-4FFC-B83B-FEE68FC1F80B}
82021-05-12 02:36:40{25D734D3-4F75-4FFC-B83B-FEE68FC1F80B}
92021-05-12 02:36:47{2D6FAD89-05BC-432E-9D66-C6ACDF596972}
102021-05-13 09:02:14{838879B0-B4D6-4DBF-A285-C9587135C9F9}
112021-05-13 09:02:14{9CFB062C-8E6E-4397-81EE-32942E00BD22}
122021-05-13 09:02:24{9CFB062C-8E6E-4397-81EE-32942E00BD22}
132021-05-13 09:02:27{838879B0-B4D6-4DBF-A285-C9587135C9F9}
Sheet4


Any help would be greatly appreciated.

Thanks,
Ray
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
try Aggregate or with 365 Max Filter Min Filter

Date and Time 2021.xlsm
ABC
1Date TimeEventID
212-05-21 00:54{050A0E27-6095-4E71-9187-C6EFFC12C272}00:00:13
10b
Cell Formulas
RangeFormula
C2C2=AGGREGATE(14,6,$A$2:$A$11/($B$2:$B$11=B2),1)-AGGREGATE(15,6,$A$2:$A$11/($B$2:$B$11=B2),1)
 
Upvote 0
Solution
Heres a couple:

=MAXIFS(A:A,B:B,B2)-MINIFS(A:A,B:B,B2)
=ABS(2*(AVERAGEIFS(A:A,B:B,B2)-A2))
 
Upvote 0
try Aggregate or with 365 Max Filter Min Filter

Date and Time 2021.xlsm
ABC
1Date TimeEventID
212-05-21 00:54{050A0E27-6095-4E71-9187-C6EFFC12C272}00:00:13
10b
Cell Formulas
RangeFormula
C2C2=AGGREGATE(14,6,$A$2:$A$11/($B$2:$B$11=B2),1)-AGGREGATE(15,6,$A$2:$A$11/($B$2:$B$11=B2),1)
This worked! Thank you very much. Aggregate isn't something i've used before, it's very useful.
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

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