Nested IF Statement - I think

FanofExcel18

Board Regular
Joined
Jun 7, 2018
Messages
65
Trying to put together a formula to tell me the number of hours based on the following parameters:
1. Time between Online/Offline
2. Online always is first
3. How much time between Online and Offline for the day
4. Some times multiple entries for a person within a day
5. Sometimes Online will come up twice back to back. Formula would need to ignore that


[TABLE="width: 397"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]Full Name[/TD]
[TD]Online/Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]8:06 AM[/TD]
[TD]John Smith[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]8:06 AM[/TD]
[TD]John Smith[/TD]
[TD]Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]10:30 AM[/TD]
[TD]John Smith[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]12:47 PM[/TD]
[TD]John Smith[/TD]
[TD]Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]2:11 PM[/TD]
[TD]John Smith[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]4:19 PM[/TD]
[TD]John Smith[/TD]
[TD]Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]7:45 AM[/TD]
[TD]Jane Doe[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]7:45 AM[/TD]
[TD]Jane Doe[/TD]
[TD]Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]8:37 AM[/TD]
[TD]Jane Doe[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]8:37 AM[/TD]
[TD]Jane Doe[/TD]
[TD]Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]1:03 PM[/TD]
[TD]Jane Doe[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]1:03 PM[/TD]
[TD]Jane Doe[/TD]
[TD]Offline[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]7:57 AM[/TD]
[TD]Jim Smith[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]10:29 AM[/TD]
[TD]Jim Smith[/TD]
[TD]Online[/TD]
[/TR]
[TR]
[TD]05/29/2019[/TD]
[TD="align: right"]12:09 PM[/TD]
[TD]Jim Smith[/TD]
[TD]Offline[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Assuming that your data is in Columns A-D, your title row is on row 1, and your first row of data in on row 2, place the following formula in E2 and copy down for all rows:
Code:
=IF(AND(C2=C1,D2="Offline",D1="Online"),ROUND(A2+B2-A1-B1,8),"")
This will show you the duration as each one is closed ("Offline").
 
Upvote 0
Assuming that your data is in Columns A-D, your title row is on row 1, and your first row of data in on row 2, place the following formula in E2 and copy down for all rows:
Code:
=IF(AND(C2=C1,D2="Offline",D1="Online"),ROUND(A2+B2-A1-B1,8),"")
This will show you the duration as each one is closed ("Offline").

This was great! I'm still struggling with:
Sometimes Online will come up twice back to back. Formula would need to ignore that
 
Upvote 0
Sometimes Online will come up twice back to back. Formula would need to ignore that
It already does. Did you try that situation?

Maybe in that situation the data doesn't look like I think it does. Can you post an example where it is not working correctly?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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