Count days worked per employee number in Excel - excel-formula

I have a timesheet entry form that people use to enter their hours worked per day. Sometimes they enter multiple entries per day because of different areas worked.
I want to count how many days worked based on the work date. There could be multiple entries per workdate.
For example:
Employee # Date Hours
12345 11/15/17 8
12345 11/16/17 4
12345 11/16/17 3
98765 11/15/17 2
98765 11/15/17 2
98765 11/15/17 2
I have a consolidated table that sums the hours worked per employee, but I also would like the days worked. So, for example:
Employee # Hours Days
12345 15 2
98765 6 1
I can't seem to put my finger on the right formula/combination of formulas to use. Countif would work perfectly if it worked similarly to sumif.

Maybe you can try Advanced Filter,then COUNTIF and SUMIF:
Hope this helps.

Related

Excel Table of Daily hours summarized by week number for a user

I'm having a hard time getting my head around what I think is a simple enough problem.
I have an Excel table of hours by day for each user i.e.:
Date1, Date1+1, Date1+2, Date1+3,... Date1+n
User1 8 8 4 6 ... 2
User2 5 2 8 3 ... 7
User3 0 7 5 0 ... 8
For forecasting purposes this grid looks several months into the future.
I do my work daily, others want it by week. I'd like to automatically generate the same table of data but rolled up by WeekNum.
I tried setting a year-weeknum at the top of the daily table and then using a SumIfs function to compare the user name and week num to sum up the daily hours in another tab for weekly data but I just couldn't get it to function properly.
=SUMIFS('Act - Forecast Hours'!$G$6:$AAL$35,'Act - Forecast Hours'!$A26,$A25,'Act - Forecast Hours'!S$4,O$3)
I think I'm overcomplicating a solution, any help is appreciated.
TIA
Rob
OK, I may have come up with an approach.
Since on my main Hourly Sheet the format is fixed, i.e. each week is 7 days and increments.
I setup a second sheet where I called a vertical and a horizontal offset and used the following formula:
=SUM(OFFSET('Act - Forecast Hours'!$G$9,$A5,D$2,1,7))
$A5 and D$2 refer to offset counts that increment by 7. As you copy the formula to each cell it increments the Row / Column to point to the right spot. Then for the Height and Width I look at a grid 1 row high and 7 wide to select each day of the week.
It works, I'm happy. I'm certainly interested in a more refined approach if there is one :-)
Thank You to anyone that does read through the question!
Regards
Rob

Number of days between two dates for certain year

How do i work out the number of days Fred and John worked during the period between Start and End, during the period of 2018?
I need a count of number of days, for Fred i would expect an output of 89 days, and John would equate to 41. I can work this out manually by doing date subtraction but with the real data there are 1000's of records, is there a way i can do a formula that captures people who worked at the start of 2018, and the end?
Try below formula as per screenshot.
=DATEDIF(IF(AND(B4>=$B$1,B4<=$C$1),B4,$B$1),IF(AND(C4>=$B$1,C4<=$C$1),C4,$C$1),"d")

Formula to find out how many times accounts transacted on the same day

I am looking for a way to find out which accounts appear to transact on the same days together the most.
I have looked into using the correlation function, but decided this would not provide the results I am looking for as I would need to be able to do this among the 6000+ different acct #s. Therefore, I have decided to try to solve this by creating a matrix of the account #s and finding out how many times each account transacted on the same day as another account, but I am open to other ideas of solving this if anyone has a better idea.
My source data is a large dataset consisting of 2 columns - Date (Column A) and Acct # (Column B).
I am currently looking into sum product, but since I do not want to look at any specific date, rather the date range as a whole, I am not getting what I want.
=sumproduct(('Trxs'!A:A='Trxs'!A:A)*('Trxs'!B:B=A$2)*('Trxs'!B:B=$a2))
What I am looking for would be a formula that I could use to pull across a matrix of the acct #s that would add up the number of times each of the 2 acct #s transacted on the same date over the time span of a month and not using a specific date to figure this out by.
1/1/2019 123456
1/1/2019 987654
1/2/2019 987654
1/3/2019 123456
1/3/2019 123456
1/3/2019 987654
1/3/2019 567890
and the outcome would be
123456 567890 987654
123456 3 1 2
567890 1 1 1
987654 2 1 3
I've came up with a solution using a helper table that counts if that account had activity that day:
The formula for the cell F12 on the helper table is:
=+IF(COUNTIFS($B$3:$B$12,$E12,$C$3:$C$12,F$11)>0,1,0)
And the formula on the Final Resul table:
Edit 2: I agree with Domenic, the formula on cell F4 works better with the IF section:
=IF($E4<>F$3,SUMPRODUCT(INDEX($F$12:$J$14,0,MATCH($E4,$F$11:$J$11)),INDEX($F$12:$J$14,0,MATCH(F$3,$F$11:$J$11))),COUNTIF($C$3:$C$12,$E4))

Count the number of absent in different sheet excel

I have 6 worksheets and each containing names of workers. The first sheet just picks data from the other five sheets each representing a week day. The other five sheets contains names of workers which is in a column A, their working hours in column B and column C is whether they are absent or not. I want a way to collect information to the first sheet such that there will be a column that will count the number of days a worker has being absent.
When a worker is absent it is marked "absent" else it is left blank.
Can I use it with VLOOKUP included?
You should be able to use a "=COUNTIFS(criteria_range1,criteria1,criteria_range2,criteria2,etc.)"
statement which might look something like: "=COUNTIFS(WorkerNameRange,WorkerName,AbsentColumn,AbsentIndicator)"
or
"=COUNTIFS(ColumnA,WorkerName,ColumnC,AbsentIndicator)"
Okay, you didn't provide a lot of information, so here is my best answer based off of some made up sample data.
We will use 3 workers, George, Bob, and Steve. George works 8 hours/day, Bob 6 hours/day, and Steve 4 hours/day. So this is what I assume the Monday sheet would look like
Monday
Bob and Steve both missed work (rough weekend), so we won't count their hours on the Total sheet. We will also count this as 1 absent for both.
Worker Hours Absent
George 8
Bob 6 absent
Steve 4 absent
Tuesday
Tuesday is similar to Monday except that only Steve was absent.
Worker Hours Absent
George 8
Bob 6
Steve 4 absent
Total Sheet
We will assume that no one was absent for the rest of the week. So George should have gotten in 40 hours with 0 days absent. Bob missed a day, so he only got in 4*6=24 hours. Steve missed two days, so his hours will be 3*4=12. Bob will have 1 absent and Steve will have 2.
Worker Hours Days Absent
George 40 0
Bob 24 1
Steve 12 2
To sum up the hours they were present, we can use the following formula in the Hours column on the Total sheet.
=SUMIFS(Monday!$B$2:$B$4,Monday!$A$2:$A$4,Total!A2,Monday!$C$2:$C$4,"")+SUMIFS(Tuesday!$B$2:$B$4,Tuesday!$A$2:$A$4,Total!A2,Tuesday!$C$2:$C$4,"")+SUMIFS(Wednesday!$B$2:$B$4,Wednesday!$A$2:$A$4,Total!A2,Wednesday!$C$2:$C$4,"")+SUMIFS(Thursday!$B$2:$B$4,Thursday!$A$2:$A$4,Total!A2,Thursday!$C$2:$C$4,"")+SUMIFS(Friday!$B$2:$B$4,Friday!$A$2:$A$4,Total!A2,Friday!$C$2:$C$4,"")
What this does is uses a series of SUMIFS() functions to check each day if the name matches and if they were absent. If they weren't absent, it adds their hours to the total. If they were absent, it does nothing. So we get the correct hour totals. We could just count the absents and then do some math with the number of days absent, but I don't know if you have people who might work different hours different days (e.g. 4 hours Monday, 6 hours Tuesday, etc.)
To count the hours, we will use a simple COUNTA() function.
=COUNTA(Monday!C2,Tuesday!C2,Wednesday!C2,Thursday!C2,Friday!C2)
This counts all cells in that workers Absent columns that are not blank. This allows you flexibility to use any mark for absent as long as blank means "not absent".
There are other ways this spreadsheet could be made more robust with Table formatting, but I will leave it up to you to do the research.

Tallying dates and times in excel

Is there an easy way to tally a column formatted as follows: "5/24/2013 5:48:00 PM"
What I want to do is have it tally by day of week and an hour time block, the end result I'm looking for would look like the following:
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
1:00-2:00AM 10 2 8 7 3 12 15
2:00-3:00AM 5 4 7 7 9 11 18
et cetera. This is an extremely large data set so avoiding doing this by hand would be amazing. I apologize if this is a terrible question, I tried searching though other people's questions to no avail.
Not knowing the details, I would try to use a PivotTable.
There is the ability to group by dates; see this page for details (including a fancy animation).
Some additional searching should turn up a lot of resources on PivotTables; they are very powerful.
I'd assign a number to the rows/columns and then use sumif().
I would create add two columns: one with =Hour(A2), other with =WeekDay(A2) (example for row 2, assuming dates are on column A).
Then, use PivotTable on all data.
Regard formats: WeekDay must be formated as ddd or dddd and Hour as numeric.

Resources