SUM values in range with same week & year in Excel - excel

Have an excel sheet with hours | week | year in A:C and I would like to calculate "weekly hours" in column D.
For each unique Week & Year combination the number of hours will be displayed.
What I tried so far
I set up unique combination of year&week and then tried to IF(F2=Unique,SUM(A:A),"false") but this just added entire hours and not only hours that were equal to the unique value.
Some similar but different questions & answers appear on StackOverflow. This one sums all data = monday
=SUMPRODUCT((WEEKDAY(A1:A8)=2)*B1:B8)
I couldnt really find anything where output was going to be written into each of the cells in a column as I need.
Possible answer
I think a query that sums values could work, but I am not sure. Appreciate any help.
Again a shared excel sheet on microsoft 360 is also available here.

Use SUMIFS():
=SUMIFS(A:A,B:B,B2,C:C,C2)
Then copy that formula down.
Or with office 365 we can do the range and it will spill:
=SUMIFS(A:A,B:B,B2:B14,C:C,C2:C14)

Related

VLOOKUP & COUNTIF

I'm looking for some help on trying to combine functions.
I think I need VLOOKUP & COUNTIF.
I have Sheet 1 with a list of clients, column A, I then have 12 other tabs Jan-Dec same table format on each, client listed in column C.
On sheet 1, I want to count from every month tab how many times listed (invoices sent)
Not every client in the list will appear on the month invoice tabs , others more than once.
Please see screenshot attached
Any advice would be appreciated.
Thank you
Amy
You only need CountIf. Just reference the client on Sheet 1:-
=countif(January!C3:C100, Sheet1!A3). Copy this down to reference the client on each row.
You could also consider the following for a better working and easier spreadsheet:-
-Define ranges and reference those instead
-Copy all your monthly data with the year into one sheet. Have a column for month and year then just autofilter to get the month you want - using countif to also reference the month and year if you just want a particular one in question
You'll find it easier to grown your spreadsheet and build formulae if your data is tidy and less dispersed.
Hope this helps,
Phil

Excel - array formula - count days in range of weeks

I am trying to get an Excel Array Formula working.
There is a list o weeks - each has a start date and an end date. There is a number of GRP in every week.
I want to SUM all GRP (proportionally) from all weeks that are between specific days.
For one week is easy
=IF(AND(B2>=$A4;B1<=$A5);IF(B1<$A4;B2-$A4+1;IF(B2>$A5;$A5-B1+1;B2-B1+1));0)/(B2-B1+1)*B3
Based on this formula I created an array formula, which doesn't work :(
{=SUM(IF(AND(B2:H2>=$A4;B1:H1<=$A5);IF(B1:H1<$A4;B2:H2-$A4+1;IF(B2:H2>$A5;$A5-B1:H1+1;B2:H2-B1:H1+1));0)/(B2:H2-B1:H1+1)*B3:H3)}
Based on Post found on Stackoverflow
Need to multiply 2 Ranges (arrays) instead of using AND :)
{=SUM(IF((B2:H2>=$A4)*(B1:H1<=$A5);JEŻELI(B1:H1<$A4;B2:H2-$A4+1;JEŻELI(B2:H2>$A5;$A5-B1:H1+1;B2:H2-B1:H1+1));0)/(B2:H2-B1:H1+1)*B3:H3)}

SUMIFS with Date Range...but X days before and X days after

I am trying to create a SUMIFS function that is adding totals based on several parameters. The final parameter is to use a date in a column and then look for any dates 7 days prior and 7 days after.
I have a list of invoices I am trying to sum up based on travel...conceivably people who are traveling will travel in a short duration. I cant add all invoices up because someone might travel at the beginning of the month and at the end, creating 2 trips.
Lets say the date is in Column I and my criteria cell is I10, I tried to enter the Criteria Range as "(I10-7)=>I10<=(I10+7)"
But this is clearly wrong. Any help is appreciated!
Try,
=sumifs(A:A, I:I, ">="&I10-7, I:I, "<="&I10+7)
Add your other criteria pairs making sure that the criteria ranges are the same number of rows as the sum range.

How do I count how many occurrences per week something happens excel?

I am looking at a rather large excel spreadsheet with a long list of dates on it. Each one of these dates marks an error. What I am trying to find out is how many errors occur per week? From there I hope to make a control chart. Thanks so much and please let me know if there are any additional details I need to provide.
Just Like TMH8885 metioned get week number from each date and then assuming that your dates are in Column A and weeknumbers are in column B make a table that list numbers from 1 to 52 next to which enter a COUNTIF(B:B,D2)(change D2 to cell pointing at correct week number of course).
In the screen shot I was lazy and included only 22 weeks for my table.
You could use the WEEKNUM function to pull which week of the year the error occurred in.
=WEEKNUM(your date cell)
From there you could use a pivot table to pull in the weeks then find the average count of errors.

Increment column based on date - Excel

I am trying to create an excel formula that will increment as the year changes. The following is what i am trying to do:
http://i58.tinypic.com/nbc1fc.jpg
I have 2 columns - date and id.
What i would like to do is increment the ID column by +1 when the year changes in the date column. So, dates from the same year will get the same id. (i am not concerned by the month/day values, all i need to do is assign the same id to dates from the same year).
I have tried a variety of formulas in excel but my excel skills are not great and i have been unable to find a solution. The best i could come up with is:
IF(YEAR(A1=1928),420) but that would be quite monotonous to do for every year in the excel file.
i did try to do a bit of research and the only similar question that i could find on here was this -->
Increment number when Date changes
Any help would be much appreciated
Please try, in say B2 assuming your data starts in A1:
=IF(YEAR(A2)=YEAR(A1),B1,B1+1)
and you have chose a value for B1. Copy down to suit.

Resources