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


DateTimeFull NameOnline/Offline
05/29/20198:06 AMJohn SmithOnline
05/29/20198:06 AMJohn SmithOffline
05/29/201910:30 AMJohn SmithOnline
05/29/201912:47 PMJohn SmithOffline
05/29/20192:11 PMJohn SmithOnline
05/29/20194:19 PMJohn SmithOffline
05/29/20197:45 AMJane DoeOnline
05/29/20197:45 AMJane DoeOffline
05/29/20198:37 AMJane DoeOnline
05/29/20198:37 AMJane DoeOffline
05/29/20191:03 PMJane DoeOnline
05/29/20191:03 PMJane DoeOffline
05/29/20197:57 AMJim SmithOnline
05/29/201910:29 AMJim SmithOnline
05/29/201912:09 PMJim SmithOffline

<tbody>
</tbody>
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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