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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
5,063
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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)
 
Solution

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,647
Office Version
  1. 365
Platform
  1. Windows
Heres a couple:

=MAXIFS(A:A,B:B,B2)-MINIFS(A:A,B:B,B2)
=ABS(2*(AVERAGEIFS(A:A,B:B,B2)-A2))
 

RayClarke

New Member
Joined
May 14, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,235
Messages
5,768,951
Members
425,507
Latest member
AndreaWorkPlace

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
Top