Getting difference between two cell based on the above cell value and below cell value

knoll126

New Member
Joined
Mar 24, 2015
Messages
23
Office Version
  1. 365
[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 98"]
<tbody>[TR]
[TD="width: 98"]BehEvent[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="width: 54"]Time[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Lobtailing[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]21:11.2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Blow
[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]21:33.6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Blow[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]22:21.7[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Blow[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]22:36.3[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Lobtailing[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]23:26.5[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Lobtailing[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]23:30.6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Blow[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]24:07.6[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Blow[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]24:29.8[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]Fluke Up Dive[/TD]
[TD][TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl65, width: 54, align: right"]24:50.9[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

I would like help trying to create a formula to subtract the difference in time between the first blow and the last blow of the same sequence. So between Lobtailing and Lobtailing and between Lobtailing and Fluke Up Dive. So getting the difference between 21:33.6 - 22:36.3 and 24:07.6 - 24:29.8. Any ideas?

Thanks.
 

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.
Hi,

Don't know how you might want your layout to look like, but here's one way, shown with or without the words "Time interval is:", which you can change to say anything you want.


Excel 2010
ABC
1BehEventTime
2Lobtailing21:11.2 
3Blow21:33.621:33.6
4Blow22:21.7
5Blow22:36.3Time interval is: 01.02.7
6Lobtailing23:26.5
7Lobtailing23:30.6
8Blow24:07.624:07.6
9Blow24:29.8Time interval is: 00.22.2
10Fluke Up Dive24:50.9
Sheet1
Cell Formulas
RangeFormula
C2=IF(AND(A2="Blow",OR(A1={"Lobtailing","Fluke Up Dive"})),B2,IF(AND(A2="Blow",OR(A3={"Lobtailing","Fluke Up Dive"})),"Time interval is: "&TEXT(B2-LOOKUP(9.99999999999999E+307,C1:C$2),"mm.ss.0"),""))



Excel 2010
ABC
1BehEventTime
2Lobtailing21:11.2 
3Blow21:33.621:33.6
4Blow22:21.7
5Blow22:36.301:02.7
6Lobtailing23:26.5
7Lobtailing23:30.6
8Blow24:07.624:07.6
9Blow24:29.800:22.2
10Fluke Up Dive24:50.9
Sheet2
Cell Formulas
RangeFormula
C2=IF(AND(A2="Blow",OR(A1={"Lobtailing","Fluke Up Dive"})),B2,IF(AND(A2="Blow",OR(A3={"Lobtailing","Fluke Up Dive"})),B2-LOOKUP(9.99999999999999E+307,C1:C$2),""))


C2 formula copied down.
 
Upvote 0
And here's a solution using a helper column (in column C).

I'm assuming all cell references are the same as in post #4 .

The helper column can be hidden if required.

In C2
=IF(AND(A2="Blow",A1<>"Blow"),B2,IF(AND(A2="Blow",A1="Blow"),C1,0))

In D2
=IF(AND(A2="Blow",A3<>"Blow"),B2-C2,"")

And copy both down as far as required.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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