Excel: Count billing hours for specific month, week, year - excel

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

Related

How to count number of times someone's tenure falls into each month range in Excel

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.

Excel count days per month between two dates using both months and years

I would like to know how to calculate days of each month between two dates:
A
B
C
D
E
F
G
1
From
To
01/12/20
01/01/21
01/02/21
01/03/21
01/04/21
:--
:---------:
:-----:
:---------:
:--------:
:--------:
:--------:
:-------:
2
15/12/20
12/3/21
17
31
28
12
0
I have tried using a formula I found elsewhere on this website but it only picks up the relevant months from the column headers in row 1. I need it to pick up the years as well. I wonder if anyone is able to alter this formula to include years as well:
=SUMPRODUCT(--(MONTH(ROW(INDIRECT($A2 & ":" & IF($B2="",TODAY(),$B2))))=MONTH(C1)))
Note: Row 1 Dates are dates and not text.
Charles
Try:
C2: =MAX(MIN(EOMONTH(C$1,0),$B2)-MAX(C$1,$A2)+1,0)
and fill across (and down) as needed.

In Excel how do I find a column then sum between two dates?

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))

FCR calculations in excel

I am trying to work the (First Contact Resolution) FCR in excel however so success.
Does anyone know an automated formula used in excel?
We have been trying to use formulas to check how many times a customer with the same customer ID calls us in 7 days.
Assuming your requirement
ID Date Calls Count in last 7 days from today
1 13-Mar-17 2
2 14-Mar-17 0
5 15-Mar-17 1
1 16-Mar-17 2
3 17-Mar-17 1
5 18-Mar-17 1
7 19-Mar-17 1
9 20-Mar-17 1
1 21-Mar-17 2
13 22-Mar-17 1
2 23-Mar-17 0
17 24-Mar-17 0
5 25-Mar-17 1
21 26-Mar-17 0
Putting ID in Column A and Dates in Column B and records starts from row 2
put this formula in Cell "C2":
=COUNTIFS(A:A,A2,B:B,">="&TODAY()-6,B:B,"<="&TODAY())
and drag it all way down to see the number of calls
or put this formula if you want to calculate last 7 days from the date in sheet:
=COUNTIFS(A:A,A2,B:B,">="&B2-6,B:B,"<="&B2)
Please let me know if you meant something else as I tried my best to assume the senario.

Determine number of days within a date range across multiple years

I hope I can explain this properly. I need to calculate occupancy time for a population of migratory animals. Occupancy is defined as the period, in days, between the first and last sighting of an individual in a given year between 1999 and 2015. A sample of the type of sighting data I am dealing with is pasted below. I need to be able to calculate the number of days between sightings within a year and NOT between the first and last sightings or between each sighting. Further, I need a value of "1" if the animal was only seen once in that year, rather than a value of "0".
So, for example, based on individual 37 in the data below, the results table would look something like
1999 - 0 2000 - 11 2001 - 40 2002 - 2 2003 - 0
1999 - 0
2000 - 11
2001 - 40
2002 - 1
2003 - 0
2004 - 52
2005 - 1
...and so on.
I have tried this series of equations but it does not return the right values for the years in which an animal was seen only once and it ignores any years prior to the first year seen.
in cell K2:
=DATE(YEAR(MIN($B$2:$J$2)),1,1)
in cell L2:
=IF(N(K2)=0,"",MAX(MAX(IF($B$2:$J$2=K2,$B$2:$J$2)),0))
in cell M2:
=IF(N(K2)=0,"",IF(MAX($B$2:$J$2)>DATE(YEAR(K2)+1,1,1),DATE(YEAR(K2)+1,1,1),""))
so if more than 1 year between sightings then it should be 0?
and is that more than "365 days a year" or if it is spotted 1 time 1. december and 1 time 1. januar then its still only spotted 1 time pr year...
I was able to find a solution using this equation in the cells immediately following the last sighting.
=IF(COUNTIFS($B2:$V2,">="&DATE(BE$1,1,1),$B2:$V2,"<="&DATE(BE$1,12,31))>0,LOOKUP(DATE(BE$1,12,31),$A2:$V2)-INDEX($A2:$V2,MATCH(DATE(BE$1,1,0),$A2:$V2)+1)+1,0)

Resources