How to find the last 8 quarters and their years from the current quarter and year or a given date - excel

I am trying to find the last 7 quarters from the given quarter and year in MS Excel.
For eg.
if I have Q1 2016 then I should be able to find Q4 2015 in one cell and Q3 2015 in another cell and so on showing the last seven quarters. This should be dynamic i.e when the current quarter changes, the year should move also wherever required.
I have been able to find the last quarter number using the following formulas:
=CHOOSE(CEILING(MONTH(E4)/3,1),1,2,3,4)
and
=IF(F5-1=0,4,F5-1)
But I am not able keep the year dynamic.
If the current quarter is Q1 2015 then the quarters I need would be:
Q4 2015
Q3 2015
Q2 2015
Q1 2015
Q4 2014
Q3 2014
Q2 2014

Your question is not clear. But, with some date in E4, the following formula will return Qn YYYY. If you then fill right, it will return the preceding quarters. If your layout is different, you will need to adjust the formula accordingly.
EDIT Formula adjusted to be able fill right instead of down
F5: ="Q" & INT(MONTH(EDATE($E$4,-(COLUMNS($A:A)-1)*3))/3)+1 &" " & YEAR(EDATE($E$4,-(COLUMNS($A:A)-1)*3))
The formula subtracts a multiple of 3 months from the date in E4; and computes the quarter and year for that date. By using the ROWS function, that multiple is incremented each time you fill down one row.

Related

excel formula for previous quarters

I am looking for a formula to pull up the previous quarter and year like in the Column J, for the Oct 20, it should return Q3 20 instead of Q4 20.
Currently my formula only returns the correct quarter but I would need the previous to last quarter and year?
To return the quarter | year corresponding to 3 months ago, i.e. :
"previous quarter & year"
simply replace col H date references with edate(date,-3). Cell J17 formula to enter is then:
="Q"&ROUNDUP(MONTH(EDATE(H17,-3))/3,0)&" "&YEAR(EDATE(H17,-3))
If you have Office 365 compatible version of Excel, you could shorten (albeit ever so slightly in this case) with the let function as so:
=LET(x,EDATE(H17,-3),"Q"&ROUNDUP(MONTH(x)/3,0)&" "&YEAR(x))

Automatically change excel cell value depending on current Month

Stock analysis Dashboard. I need to compare the stock from today vs the previous 6 months.
My stock data
Cell A1:R1 - month data example Cell A1= June 2017, B1= 7/2017 ....till R1= December 2018.
Cell A2:R2 Stock numbers data example A2=23, B2=25,........till R2=50.
IF I want to see the stock today month which is July 2018= M1 vs six months February 2018 H2 and the stock level calculation will which is M2=26 - H2= 30 =-4.
But instead of entering formula every time I need to be updated every month based on the today month?
Any tips on how to do it?
Thanks
I also miss a date...
If you use today() function to identify today's date you can use:
=HLOOKUP(TODAY(),$A$1:$S$2,2)-HLOOKUP(DATE(YEAR(TODAY()),MONTH(TODAY())-5,1),$A$1:$S$2,2)
If you need a cell with a specific date, replace today() formula with that cell.
I find the question a bit confusing. If A1 is June 2017, I am missing a month if R1 is December 2018 and July 2017 is in M1. Also, even though you said 6 months, I am assuming that you want 5 months so that July compares to February.
This response assumes that A1 is wrong but R1 and M1 (and B1 through R1 are accurate) and that the values in A1 through R1 are actually an Excel date that is formatted as m/yyyy (as opposed to some text representation of a date).
This formula is further complicated since I do not know what day is used in the date representation in A1 through R1, hence I am adapting both that date and the current date to be a fixed day of the month (I chose the first day of the month in my formula).
Here is the formula that computes the -4 assuming M1 is 7/2018, M2 is 26, H1 is 2/2018, H2 is 30 and we want to compare column M to column H since today is in July and we want to compare July to February (5 months difference):
=INDIRECT("R2C"&MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),DATE(YEAR(A1:R1),MONTH(A1:R1),1),0),FALSE)-INDIRECT("R2C"&MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),DATE(YEAR(A1:R1),MONTH(A1:R1),1),0)-5,FALSE)
This is an array function so it needs to be entered with [Ctrl]+[Shift]+[Enter].
The way it works is that it computes from today's date, the date value equal to the first day of this month. Then it compares that against the range A1:R1 with each of those dates likewise moved to the first of the month. This gives us the column to use for "this month" and using the same computation but subtracting 5 gives us the column to use for "six months ago." Out of sheer laziness I used these values in an indirect cell reference to pull the Row 2 values for "this month" and "six months ago" and subtracted the latter from the former (i.e., "this month" - "six months ago").
In other words, this part of the formula gives me the column of the current month:
MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),DATE(YEAR(A1:R1),MONTH(A1:R1),1),0)
and this part gives me the column of the month six months ago (as defined in the original post):
MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),DATE(YEAR(A1:R1),MONTH(A1:R1),1),0)-5
As I indicated, this may not be what you wanted, but this is what I thought you were asking.
Alternate version using INDEX function
=INDEX(A2:R2,MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),DATE(YEAR(A1:R1),MONTH(A1:R1),1),0))-INDEX(A2:R2,MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),DATE(YEAR(A1:R1),MONTH(A1:R1),1),0)-5)
The above would also be entered as an array formula.

How to Display months based on the Quarter Selection

I have 2 columns in Excel sheet, Column1 has the Quarter Selection dropdown box(Q1, Q2, Q3 and Q4). And Column2 has the month selction dropdown box.
I need help in the below.
Q1 - Feb, March, April
Q2 - May, Jun, July
Q3 - Aug, Sep, Oct
Q4 - Nov, Dec, Jan
Now if a user selects Quarter as Q2 in Column1, the Dropdown values in Column2 has to have only May, June and July.
I tried the grouping option but it doesn't help me.
Thanks in Advance,
Satish D
You should create two tables, one containing quarters, and other containing all quarters with corresponding months (tables are surrounded with thick border).
Then in cell A2 create simple data validation and set list in D1:D4 as source.
In cell B1 also create data validation list, set allow to list, and in formula area please enter this formula =OFFSET(INDIRECT(ADDRESS(MATCH($A$1,E1:E12,0),5)),0,1,3,1)
You data validation list in cell B1 is now dependent on selection in list A1.

Excel formula to calculate YTD metrics by detecting current month

I have two excel tables - 2015 sales and 2014 sales in the following format. And a third table called Year over Year Variance which looks at % change in 2015 over 2014.
2015 Jan Feb Mar .... YTD (total)
Orders
Revenue
...
...
2014 Jan Feb Mar .... YTD (total)
Orders
Revenue
...
...
Variance Jan Feb Mar .... YTD
Orders
Revenue
...
...
Computing Jan variance over Jan or Feb variance over Feb is simple. How do I compute Year to date variance. Because the 2014 table is already populated for the whole year - so the last column is the sum of 12 months of data.
For 2015, I only have Jan and Feb. So the variance column for Year to date should be (Jan+Feb 2015)/(Jan+Feb 2014). How do I write a formula to check for the current month and then sum only those two months for the year to date calculation?
Using Excel formulas (no-VBA), you can couple the SUM, OFFSET, and COUNT functions to calculate the variance. In the simplified formula below, Row 1 is fully populated across all 12 months. Row 2 is only populated for 2 months. Using the COUNT formula across the range, the OFFSET will expand the width based on the number of populated rows.
Let me know if you have any problems adapting it.
=SUM(OFFSET($A$2,0,0,1,COUNT($A$2:$L$2)))/SUM(OFFSET($A$1,0,0,1,COUNT($A$2:$L$2)))
=Month(Today())
will return the current month (integer, 1-12) in the spreadsheet.
Month(Now)
will do the same thing in VBA code.
I'd use a formula in the 3rd table along the lines of
=if(Month(Today())<=Month(*date-of-column-header*), *Computed-Variance*, 0)
That way, you simply have zero show up in the cells where the comparison makes no sense, and your sum of the numbers in the row is unaffected.

add values for a range between reference date minus 6 days in excel

i would like to add the corresponding values of dates with reference to a particular date and -6 days in excel.
For example: reference date is 10th feb 15. I would like to add values under flight time column for dates ranging between 10th feb 15 and previous 6 days.
similarly add values for a reference date and previous 30 days values and 1 year values.
What i wanted was, sum all the flight timings of a particular date in column A. I used the sumifs formula to achieve this.
The formula is =SUMIFS($I$8:$I$1122,$A$8:$A$1122,"<="&C8,$A$8:$A$1122,">="&C8-6)
What it does: Here the reference cell is C8 which is 6th Feb 14
step 1- date range for the calculation is 6th feb 14 minus 6 days
step 2- add the values of column I which correspond to all the dates that fall within 6th feb 14 to 31st jan 14
step 3- indicate the sum in column K
Unfortunately i cannot include any pictures or files to show what i have mentioned due to site limitations.

Resources