Counting employees logged in during specific hours for a specific amount of time

amulder

New Member
Joined
Oct 28, 2016
Messages
20
Hi,


I am banging my head against the wall on this issue. Below is my sample dataset:


Employee ID LoginHr LogoutHr
123 01/01/2017 09:29:31 01/01/2017 17:51:10
234 01/01/2017 03:11:01 01/01/2017 14:10:31
456 01/01/2017 23:59:59 01/02/2017 06:00:32
789 01/02/2017 07:00:09 01/02/2017 07:05:11


What I need to do is count the number of employees who were logged in for each hour of each day and within each of those hours only count the employees who were logged in for 15 minutes or more. So my result should look something like this:


Date Count of Logged in Employees
01/01/2017 09:00:00 2
01/01/2017 10:00:00 2
...
01/01/2017 13:00:00 2
01/01/2017 14:00:00 1
...
01/01/2017 17:00:00 1
01/01/2017 18:00:00 0
...
01/01/2017 23:00:00 1
...
01/02/2017 05:00:00 1
01/02/2017 06:00:00 0
01/02/2017 07:00:00 0


I have setup a Date table that has the dates/times and then am using a calculation to reference back to the original data set (Employees) to count the number of rows, but am not getting correct results. Can anyone help me find a solution:


=CALCULATE(COUNTROWS('Employees'),FILTER('Employees',('Employees'[LOGINHR] >= 'Date'[DATE_HOUR])&&'Employees'[LOGOUTHR]<= 'Date'[DATE_HOUR]))
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
See if this helps.


Excel 2010
ABCDEFG
1Employee IDLoginHrLogoutHr
21231/1/17 9:291/1/17 17:511/1/17 10:002
32341/1/17 3:111/1/17 14:101/2/17 5:001
44561/1/17 23:591/2/17 8:001/2/17 7:002
57891/2/17 7:001/2/17 7:051/4/17 10:00-
Sheet1
Cell Formulas
RangeFormula
G2=COUNTIFS($B$2:$B$5,"<="&F2,$C$2:$C$5,">="&F2)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,756
Members
448,990
Latest member
Buzzlightyear

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