Calculating Yearly Average by current month - excel

I need to create a SS that calculates the yearly average from January until the end of the previous month.
Excel Example
Currently I have =SUM(A2:G2)/12 and each month I go in an change the range, but I would like it to update each month to include the month that just finished.
Any help would be appreciated.

Perhaps:
=IF(TEXT(TODAY(),"mmm")="Jan",0,SUM(A2:INDEX(A2:L2,,MATCH(TEXT(TODAY(),"mmm"),$A$1:$L$1,0)-1))/12)
Alternate:
=IF(MONTH(TODAY())=1,0,SUM(A2:INDEX(A2:L2,,MONTH(TODAY())-1))/12)

If laid out as shown above:
=AGGREGATE(1,6,A2,OFFSET(A2,,MONTH(TODAY())-2))
I am adding minus 2 to go to prior month and Aggregate function to allow me to specify to ignore any error values.

Related

Excel count number of dates (in rows) which fall under a predetermined period

So i have been playing with Excel for a while, and one thing led to another, i wanted to try this: How would i calculate the instances of dates (such as below) in one sheet
And count which of those dates fall under the 30/60/90 day period (such as below) I'm looking to see if i could have a final tally up the number of instances of dates which fall below 30/60/90 days to the current date in another sheet.
Using the table example gave that i would know that 2 dates fall under the 30/60 days period, and one fell under the 90 days period
Is there a solution to my predicament?
Edit: More accurate question
Use nested IF() function.
=IF(TODAY()-B2<=30,30,IF(TODAY()-B2<=60,60,IF(TODAY()-B2<=90,90,"Other period")))
Or try IFS() if you have Excel-365.
=IFS(TODAY()-B2<=30,30,TODAY()-B2<=60,60,TODAY()-B2<=90,90)
Another option is-
=XLOOKUP(TODAY()-B2,{30,60,90},{30,60,90},"Other Period",1)
You could try:
Formula in E2:
=SUMPRODUCT(--(CEILING(D$6-B$2:B$6,30)=D2))

How to Calculate relative week diff in excel. If I Have Year and week in one column

I am trying create a data set and finding it difficult to do it manually. I just wanted to know if there is way we can do it automatically in Excel.
I am trying to calculate the week difference with reference current year & calendar week.
Below is the formula used to calculate current year & calendar week
=YEAR(TODAY())&WEEKNUM(NOW()) Result would be 201840
I am expecting the weekdiff calculation as shown below. Any help in this regard would be deeply appreciated.
Thanks,
Ganesh
I would try to convert Year/Week to the overall week since 0 A.D. and then subtract. This may need some adjustment for Leap years.
=(YEAR(TODAY()) * 52) + WEEKNUM(NOW()) - (VALUE(LEFT(A2,4))* 52) - VALUE(RIGHT(A2,2))

How to create a 'past 3 months' time period in Google Data Studio

I'm trying to have my line chart show data for the past 3 months. GDS has a 'last quarter' date range, but this shows me Q1, Q2, Q3, or Q4. What I need is the data for the past 3 full months (not counting the current month). I tried creating a calculated field but the documentation isn't proving very useful for the matter at hand.
eg. If the current date is Feb-20, I want to show data from 'Nov 1 - Jan 31'. Also need to compare to same period from last year.
Can anyone help? Thanks in advance!
I don't think this is possible in the way you're describing. You can achieve the same by creating a metric in your data source and then applying a filter at the page / chart / report level to remove data which doesn't meet your criteria
You can use the option "advanced" in the date dropdown and set the start date to today minus 3 months.

Count entries for current month

So I want to count how many entries have been filed in the month of July. Could someone help me how to do that so every month when the new data is added it automatically updates and gives new data for each month. I know I need to use combination of =CountIfs, =today, Month, =Year but not sure how exactly to formulate that.
Use SUMPRODUCT()
=SUMPRODUCT((YEAR($A$1:$A$100)=YEAR(TODAY()))*(MONTH($A$1:$A$100)=MONTH(TODAY())))
This will count every month that is the same as the month today.
Here is the COUNTIFS version for the original question
=COUNTIFS($A$1:$A$100,"<="&EOMONTH(TODAY(),0),$A$1:$A$100,">"&EOMONTH(TODAY(),-1))
or
=COUNTIFS($A$1:$A$100,"<"&DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),$A$1:$A$100,">="&DATE(YEAR(TODAY()),MONTH(TODAY()),1))
You might be thinking of something like =countifs(month($A$1:$A$100),month(today)) but unfortunately it doesn't work - the first value in the countifs has to be a range and you can't use a function here so it has to be done with a SUMPRODUCT as in Scott Craner's answer.

grouping in an excel pivot table with different year end and quartiles

I have a pivot table with a lot of items currently grouped by date into quartiles and then months under that. My question is this, Our Financial year is not Jan to Jan so can I set up quartiles to reflect this? also our financial periods are not simply set months, they follow the months but are always full weeks around that. for example, P1 this year is 04/07/2015 - 07/08/2015. and Q1 would be 04/07/2015 - 02/09/2015.
Aside from manually grouping is there a way to set this up to happen automatically within Excel?
As stated by pnuts in the question's comments:
The most practical way may be to define the quarters (?) in your source data.
If you are at least using a Gregorian calendar, you may want to subtract an offset from your dates (i.e. # of days between 01-Jan-YYYY and DD-MMM-YYYY ... whereby the offset YYYY doesn't need to be the same as your date's YYYY). By this subtraction you get an "ordinal number" of the date within your business year.
[offset] =[FOY]-DATE(YEAR([FOY]),1,1)
So with your year starting on [FOY]=04-Jul-2015, you have an offset of of 184 days and a normalized date of
[date_normalized] = [current_date]-[offset]
So 04-Jul-2015 will be shrunk to 01-Jan-2015. Now the quarter easily calculates to
=CEILING(MONTH([date_normalized])/3,1)
... or =VALUE(MID("111222333444",MONTH([date_normalized]),1)) ... if you prefer
For your not-quite-months always being full weeks, I suggest to calculate a week number by
=MOD(CEILING(([date_normalized]+1)/7,1)-1,52)+1
to create a weekly reporting period 1 .. 52. With a further =CEILING(.../4,1) this can be converted to quasi-months having 4 weeks each.

Resources