We have a data-set generated by an HR system of staff times, which isn't in the most helpful of formats.
We need to count the # of staff who start work before 10.00, and split those counts by week number (1-4) and day (Sun-Sat).
Every group of rows (1-4) is an individual.
Here's an example day's data:
Week Start
1 -
2 10:00
3 09.00
4 09.55
1 09:25
2 10.00
3 10:25
4 10.25
1 09:25
2 09.55
3 08:00
4 10.00
1 10:25
2 09.25
3 09:25
4 10.15
1 10.00
2 08:25
3 09.45
4 11:25
So I can count the occurence of start times before 10am on the entire column with:
=COUNTIFS(L5:L203,">=00:30",L5:L203,"<=10:00")
but to do separate counts for every 4th row (so sum all for ones on week 1, all on week 2, etc) is beyond me.
I tried the following after searching similar questions, but it didn't work:
=COUNTIFS((MOD(ROW(L5:L203),5)=0),">=00:30",(MOD(ROW(L5:L203),5)=0),"<=10:00")
Ideally I'd be able to put values into a table with a count for week 1 on Sunday, week 2 on Sunday, week 1 on Monday, and so on.
Any ideas?
To count the weeks use:
=COUNTIFs(B$2:B$21,"<=10:00",$A$2:$A$21,"=1")
=COUNTIFs(B$2:B$21,"<=10:00",$A$2:$A$21,"=2")
Changing =1, =2, =3, =4 for each weeks count. If column B is Monday and column C is Tuesday, you can drag the above formulas right across the row to get the weekly counts for other days.
Related
I am trying to count the number of months someone's tenure falls into each range but am struggling to come up with a formula that works. For example:
Year-End Tenure Year-Start Tenure Month 1-6 Month 7-12 Month 13-24
23 12 0 1 12
56 45 0 0 0
11 0 6 5 0
The first employee starts the year having worked for this company for 12 months and ends the year having 23 months tenure. Therefore, they spent 0 months in the Month 1-6 bracket, 1 month in the Month 7-12 bracket, and 12 months in the Month 13-24 bracket.
The following two examples follow the same logic. I need a formula to calculate the numbers in Month 1-6, Month 7-12, and Month 13-24 columns.
In excel I have a pivottable:
Project
11/1/2021
11/2/2021
11/3/2021
Dept 1
5
5
5
Dept 2
2
5
5
Dept 3
5
4
6
Dept 4
5
3
5
The table spans the full length of the month. I need a calculation that would find the department I input then sums all figures between today's date and the last day of the month:
Dept
Total
Dept 1
15
I have tried
=SUMPRODUCT(((Today()<=B1:K1)*(EOMONTH(TODAY(),0)>=B1:K1))*(A2:A5="Dept 1")*(B2:K5)
and various different vlookups but I can't figure out how to both find the correct row and then sum everything between the two dates in that row.
Assuming the following structure:
Try this, it works:
SUM(INDIRECT(ADDRESS(MATCH($B$2,$A:$A,0),COLUMN($B$6))&":"&ADDRESS(MATCH($B$2,$A:$A,0),MATCH($B$3,$6:$6,0)),TRUE))
I am in much need of help please.
I have the table below.
It has about 300 rows and columns on the right for each day of the year starting 2015, ending 2019. I only entered a few columns here as an example.
What I need:
A formula to split the time (it can be hours or decimal days, it doesn't matter) between the two days on the left on the columns to the right.
In the rest of the days, which are not included in the period, I need a zero in those columns.
I manually entered the results I need so it can help you understand.
E.g.
On the first row:
The employee has spent
15 hours at destination in the first day of travel,
24 hours in the second day of travel
11:50 hours in the last day of travel.
All the rest of the columns to the right, which are not here, starting 1/4/2015 23:59 should give the result zero.
Thank You!!
Entry Date Exit Date 1/1/2015 23:59 1/2/2015 23:59 1/3/2015 23:59
1/1/15 9:00 1/3/15 11:50 15.00 24.00 11.50
As far as I can tell, it boils down to this
1.0 days 2.0 days 3.0 days 4.0 days
period=p in h/d.d p-(1-(so far)) p-(2-(so far)) p-(3-(so far)) 0
EDIT 2: I've come up with a formula.
NOTE:
This formula assumes existence of a column that specifies 0 hours of work between the "end date/time" column ("B") and first work hour ("D"), so you have it like this:
A B C D E F G H
1 Entry Date Exit Date ZERO 1/1/2015 23:59 1/2/2015 23:59 1/3/2015 23:59 1/4/2015 23:59 1/5/2015 23:59
2 1/1/15 9:00 1/3/2015 11:50 0 0.6243055556 1 0.49375 0 0.00
3
The extra column is there to avoid circular dependencies, since
we must "iteratively" accumulate the hours
The main formula for row 2 from column D being:
=MIN(D1-$A2,MIN(MAX(($B2-$A2) - SUM($C2:C2), 0),1))
Note: semicolons may be needed instead of commas in Excel as delimiters.
Note: the last digit in the formula depends on the unit. Here it is in days decimal. If hours, put 24.
In plain English, for a cell
Calculate sum of hours/days decimal in the range C to wherever - 1
Subtract result from the difference between start and end (total hours)
If less than 0, put 0 (MAX(x, 0))
If more than 1, put 1 (MIN(x, 1))
Choose between the result, or the difference between current date and start time, if it is smaller
I have three columns in my spreadsheet ID, Time and Height. What I want to do is run through the ID column and where the IDs match (Same ID occurs more than once in the list) sum the Height together for the earliest time (see example 2)
Example 1 (What I currently have)
ID Time Height
AB123 06:00 10
AD1234 10:00 10
AC12345 14:00 10
AC12345 06:00 10
AE123456 10:00 10
Example 2 (What I'm looking for)
ID Time Height
AB123 06:00 10
AD1234 10:00 10
AC12345 14:00 10
AC12345 06:00 20
AE123456 10:00 10
Within the sheet there may be 2, 2, 3 or 4 occurrence of the same ID number with multiple times.
I someone could help me with the VBA code for this I'd be very grateful.
I have four columns in a spreadsheet, Month, Week, Year, Hours and I want to 'sum' the number of hours based on the month, week, and year number. Months would be (1-12), week would be (1-52), and year would be (2009, 2010, 2011)
For example:
Month Week Year Hours Total_Hours
1 2 2011 8 12
1 2 2011 4 12
1 2 2010 7 7
1 2 2009 5 5
Not sure if I should use vlookup or a nest 'if'. If someone else has a better approach, please let me know.
Thanks in advance.
First, you create another column that is a string concatenation of the first three, and drag down:
=TRIM(A2) & TRIM(B2) & TRIM(C2)
Then, you use this formula for Total_Hours, and drag down:
=SUMIF(D:D, D2, E:E)
My example uses your sample, and inserts a new column D for the concatenation.
End Result:
Month Week Year Concat Hours Total_Hours
1 2 2011 122011 8 12
1 2 2011 122011 4 12
1 2 2010 122010 7 7
1 2 2009 122009 5 5
Of course, I'd use Named Ranges for anything that's likely to change.
If you use VLOOKUP ensure the textual data is formatted correctly or use Text and Data functions