Excel - array formula - count days in range of weeks - excel

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

Related

Excel - How to sum values for specific days

How can I sum all the OT(hr) value only for specific day?
Requirement: I need to sum all the OT(hr) for one person for Sunday only. One person means one row in the table.
I tried this few code but it doesn't work :
=sumif(WEEKDAY(1,1),O8:AD8) or
=SUMIF(O8:AD8,TEXT(O6:AD6,"dddd")="Sunday")
Thank you so much
In my example, I don't use merged cells. I wouldn't recommend having merged cells for the date. Date must be above the OT (hr). And the Ot (hr) you also need to put into the formula.
This formula was working for me:
=SUM((WEEKDAY(O2:AD2;1)=1)*(O3:AD3="OT (hr)")*(O4:AD4))

filter data between 2 dates in excel using VBA

i was wondering if someone can help. i have tried some formulas but cant seem to work this out. i have a list of data with lots of dates some duplicate dates which are fine. i have data on a daily basis from 2015-2018. my aim is to try to put a number against each week between 2 dates so Monday-Sunday representing a week. so if the date falls between to dates bring back the week number. but of course there is a long list of date ranges and week ranges. does anyone know a formula or code to read to date and look between 2 separate dates and bring back a week number
thanks
Muj
For a given date, weeknum() will return the week number:

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