Excel - Sum QTD values based on selected month - excel

Desired end state: The QTD field sums the quarterly values to date so as an example for October it would return just the October value (1st month in Q4) but when November is selected as the driver the QTD field would sum Oct + Nov values (ignoring the value for Dec).
I have a spreadsheet with drivers and the current date will be updated daily. This date drives the "Current Month" field from which I want the QTD values to recalculate.
See example linked below. Expected results - Cat 1 QTD for Nov would be 3,387,280; Cat13 QTD for April would be 1,121,021 and so on
Thanks in advance!

In O6:
=SUMIFS(C6:N6,$C$4:$N$4,"<="&MONTH("1 "&A2),$C$4:$N$4,">="&MATCH(INDEX($1:$1,MATCH(MONTH("1 "&A2),$4:$4,0)),$C1:$N1,0))

Alternative approach using SUMPRODUCT:
=SUMPRODUCT(C6:N6,--(("Q"&ROUNDUP(MONTH(1&$A$2)/3,0))=$C$1:$N$1),--($C$4:$N$4<=MONTH(1&$A$2)))
Result:

Related

Excel - How to do the following?

I have a question related to EXCEL:
Since I have the following prices for different period, how can I compute in an automatic way, for example the price between 10 June - 15 July ?
EDIT--> Expected output:
50€+50€ (10-11 june) + 58€x13 (period 12 june - 25 June) + 75€x13 (period 26 june - 9 July) + 92€x5 (period 10 july-15july) = 2289€
This is the same pictures with the cells in excel, please do not consider the "Price of period", but only the daily price
You could do this with a (lengthy) calculation:
Consider:
A8 Contains the from date (10-06-2021)
B8 Contains the from date (17-07-2021)
=(MIN($B$8,D3)-MAX($A$8,C3)+1)*C5+(MIN($B$8,F3)-MAX($A$8,E3)+1)*E5+(MIN($B$8,H3)-MAX($A$8,G3)+1)*G5+(MIN($B$8,J3)-MAX($A$8,I3)+1)*I5
This will consider a period from 10-06 - 11-06 a period of 2 days. And also 12-06 - 25-06 a period of 14 days, and so on.
The result is: 2514.00
One method would be to create a lookup table and use a formula.
Given your data, your lookup table might as shown below:
I NAME'd it: priceTable
You can then use the formula:
=SUM(VLOOKUP(SEQUENCE(End-Start+1,,Start,1),priceTable,2))
If, for some reason, you cannot easily create priceTable, you can create it with a formula (depending on your version of Excel):
=INDEX($C$4:$I$6,{1,3},{1;3;5;7})
Note: All of the formulas assume your dates are real dates and not strings.
If your version of Excel does not have the SEQUENCE function, you can replace it with:
=SUM(VLOOKUP(ROW(INDEX($A:$A,Start):INDEX($A:$A,End)),priceTable,2))

Calculate in Excel Sum of Days given 2 date ranges (Start date , End date), aggregate monthly

Please find the excel data.
Input format:
ID Begin Date End Date Comment
1 07/25/17 08/16/17 July 6 days, August 16 days
2 05/01/17 05/11/17 11 Days in May
3 07/10/17 07/16/17 6 days in July
Output format:
Jan-17 Feb-17 Mar-17 Apr-17 May-17 Jun-17 Jul-17 Aug-17..... Dec
11 12 16
How to get this aggregate at month level, given a range
Input Format:
Output format:
Are you including start date and end date because your results aren't consistent. If ID2 is 11 days then shouldn't ID3 be 7?
Assuming that you want to include both start date and end date then you can do that like this:
Put the first of each month in A8 copied across (formatted as mmm-yy) then use this array formula in A9
=SUM(TEXT(IF($B2:$B4="",0,IF($C2:$C4>EOMONTH(A8,0),EOMONTH(A8,0),$C2:$C4)-IF($B2:$B4<A8,A8,$B2:$B4)+1),"0;\0")+0)
confirm with CTRL+SHIFT+ENTER and copy across
This only counts rows that have both start and end date
See screenshot:

Change the date to fiscal year

I want to write a function in Excel to change the date. The logic is like this: if the month is (Jan, Feb or March) the result show me one year past (-1 year) and if the month is (April to -December) the result show the current year (which year the date shows).
example: if date is 02,Jan,2012 the result show me 2011 else show me 2012.
=IF(MONTH(G3) >=4, YEAR(G3), YEAR(G3) - 1) where G3 is the date to test, is one way.
Please try:
=IF(OR(MONTH(A1)=1,MONTH(A1)=2,MONTH(A1)=3),2011,2012)
With 02-Jan-2012 in A1 try,
=YEAR(A1)-(MONTH(A1)<4)
For a full date use one of these,
=DATE(YEAR(A1)-(MONTH(A1)<4), MONTH(A1), DAY(A1))
=EDATE(A1, -(MONTH(A1)<4)*12)
To extract fiscal year use:
=YEAR(A1) + IF(MONTH(A1)>=4,1,0)
I think in your case you would need:
=YEAR(A1) - IF(MONTH(A1)>=4,0,1)
If the months is before 4th month then subtract 1 year, else keep the same year. I wouldn't convert it to a full date DD/MM/YYYY with a 1 year subtracted, to avoid confusion keep it as year only YYYY.
Already plenty of answers, but thought I'd throw another one up:
=YEAR(DATE(YEAR(A1),MONTH(A1)-3,DAY(A1)))

Excel: Value from one cell based on max value with multiple criteria in other column

I am trying to get value in column 8, based on MAX value (column Range4) with multiple criteria (Range1, Range2, Range3), but excel gives me an error "#N/A". Where is the mistake?
VLOOKUP(MAX(IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4))));Range5;8;FALSE)
The part
{MAX(IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4))))}
works right alone (it gives me the right value), but not inside the VLOOKUP function.
Thanks!
Sample data set for testing:
First_day Last_day Week_Num Week_Range Month Year Rank_name Rank_value
01/04/2013 07/04/2013 14 1-7 april april 2013 Alexa 10122
08/04/2013 14/04/2013 15 8-14 april april 2013 Alexa 9670
15/04/2013 21/04/2013 16 15-21 april april 2013 Alexa 9130
22/04/2013 28/04/2013 17 22-28 april april 2013 Alexa 8340
29/04/2013 05/05/2013 18 29-5 april april 2013 Alexa 7543
31/03/2014 06/04/2014 14 31-06 april april 2014 Alexa 11428
07/04/2014 13/04/2014 15 07-13 april april 2014 Alexa 7159
14/04/2014 20/04/2014 16 14-20 april april 2014 Alexa 7027
21/04/2014 27/04/2014 17 21-27 april april 2014 Alexa 6675
28/04/2014 04/05/2014 18 28-04 april april 2014 Alexa 5379
Equivalence between ranges and columns:
Range1 = Column "Year"
Range2 = Column "Month"
Range3 = Column "Rank_name"
Range4 = Column "Week_Num"
Range5 = Column "Rank_value"
Please try:
=INDEX(Range8;MATCH(MAX(IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4))));Range4;0))
with Control+Shift+Enter.
The problem with the existing formula (from pnuts, Jun 10 2014) is this:
The formula first narrows the list down by the nested if's, and then picks the maximum Week_Num from those rows that match your criteria. But having located that maximum, the MATCH function then ignores the criteria (they were only used to find the max from Range4). If you have other rows (even though they don't match the criteria) that have the same Week_Num, MATCH will locate the first row out of the whole list that has the same Week_Num in Range4. One solution is to add the same criteria to the MATCH's "lookup_array" that were used in the "lookup_value".
=INDEX(Range8;MATCH(MAX(IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4))));IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4)));0))
Again, using Control-Shift-Enter.
I think I entered the above formula correctly, but I didn't build a sheet to test it, so...
Also, be aware, this formula still has a problem in the case where no rows in the list meet the criteria. In that case you get an error. The solution to that is to add an IFERROR at the front of the whole thing.
=IFERROR(INDEX(Range8;MATCH(MAX(IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4))));IF(Range1=2013;IF(Range2="april";IF(Range3="Alexa";Range4)));0)),"")

Excel function to present total event occurrences based on month and year of event

In my excel file, we are tracking items in for repairs with their corresponding dates of arrival. The dates start in A3 and continue to A23. I need a function to output how many items arrived each month based on their date of arrival in C45 (July), D45 (August), ect. Is this even possible?
There are no values corresponding to these dates. That is why my previous attempts at using the LOOKUP function have failed. Thanks.
Arrival Date
7/10/2012
9/10/2012
9/18/2012
9/18/2012
9/19/2012
Total Failures July '12 August '12 September '12
Historical 1 0 4
Put =SUMPRODUCT(--(MONTH($A$3:$A$23)= 7)) in C45
Put =SUMPRODUCT(--(MONTH($A$3:$A$23)= 8)) in D45
courtesy: www.chandoo.org

Resources