Function between 2 rows

japturtle

New Member
Joined
Oct 5, 2011
Messages
12
A B C D
4/1/11 10:00 12:00
4/1/11 13:00 18:00 8 hrs
4/2/11 10:00 14:00 4 hrs
4/3/11 10:00 12:30
4/3/11 13:00 17:30 7.5 hrs

How do I create a function to get the answers listed above in Column D?? Where Column D is the value of the start and stop times in one day?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
in D2 repeat D2 (do not do anything in D1,leave it) copy this formula

=IF(AND(A2=A1,B2>=C1),C2-B1,IF(AND(A2<>A1,A2<>A3),C2-B2,""))
copy D2 down.

the result is like this

Excel Workbook
ABCD
14/1/201110:0012:00 
24/1/201113:0018:008:00
34/2/201110:0014:004:00
44/3/201110:0012:30 
54/3/201113:0017:307:30
Sheet1
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,555
Members
452,928
Latest member
101blockchains

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