Determining quarters from year, month & =now()

lenik

New Member
Joined
Jan 9, 2009
Messages
7
Hello all,

This is what I am trying to accomplish:

I need to create a filter/formula for Column H. If Column C is in the current quarter, I need H to display "Current Quarter". If Column C is in the last quarter, I need H to display "Last Quarter". For anything else previous to these two quarters, Column H can simply reflect the value of Column G.

How do I get these quarter formulas to calculate based on the current date?

Please let me know if further detail is needed. Any ideas or suggestions are greatly appreciated! :biggrin:
Excel Workbook
ABCDEFGH
1NowMonthInvoice DateInvoice MonthInvoice QtrYearValueLabel
22/9/200921/5/20091120092009Q1Current Quarter
32/9/2009212/15/200812420082008Q4Last Quarter
42/9/2009211/1/200811420082008Q42008Q4
52/9/200929/22/20089320082008Q32008Q3
62/9/200926/5/20086220082008Q22008Q2
72/9/200922/14/20082120082008Q12008Q1
Sheet
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Again, a long convoluted "pulling apart" of the possible quarters and years, so I made a chart off to the right that will cover many years. Then this will analyze and return the values. Copy the two formula down their respective columns.

Excel Workbook
ABCDEFGHILMN
1NowMonthInvoice DateInvoice MonthInvoice QtrYearValueLabel2008Q12008Q1
22/9/200921/5/20091120092009Q1Current Quarter2008Q22008Q2
32/9/2009212/15/200812420082008Q4Last Quarter2008Q32008Q3
42/9/2009211/1/200811420082008Q4Last Quarter2008Q4Last Quarter
52/9/200929/22/20089320082008Q32008Q32009Q1Current Quarter
62/9/200926/5/20086220082008Q22008Q22009Q22009Q2
72/9/200922/14/20082120082008Q12008Q12009Q32009Q3
82009Q42009Q4
92010Q12010Q1
102010Q22010Q2
112010Q32010Q3
122010Q42010Q4
132011Q12011Q1
142011Q22011Q2
152011Q32011Q3
162011Q42011Q4
172012Q12012Q1
182012Q22012Q2
192012Q32012Q3
202012Q4
Sheet3
 
Upvote 0
Perhaps try this formula in H2 copied down

=IF((YEAR(A2)=F2)*(INT((MONTH(A2)+2)/3)=E2),"Current Quarter",IF((YEAR(A2)-(MONTH(A2)<4)=F2)*(INT((MONTH(A2)-1)/3)=MOD(E2,4)),"Last Quarter",G2))
 
Upvote 0
lenik

A few comments/suggestions.

1. When using Excel jeanie, not sure if you are aware that you can use the ‘Analyse range (Forum)’ field near the top left of the Excel jeanie screen to restrict the number of formulas generated. In that field, you can use Ctrl+Click/Drag to select multiple disjoint ranges if required. There is generally no need to display multiple formulas that are basically the same, it just fills up the board. You could have just shown us the row 2 formulas and told us they were copied down.

2. It looks like you are using =NOW() to return the current date. If that is the case, it makes more sense to use =TODAY() as =NOW() also includes the current time and I don't think that is required for your purpose here.

3. Both =NOW() and =TODAY() are volatile functions so best to avoid using them too much on a shet as they can cause your sheet to become slow. More on this below.

4. Do you really need the current date and month repeated down every row in columns A & B?

- If, so I suggest putting =TODAY() in a separate cell (I used K1) and refer to that cell in the column A formulas as I have done in the top section of my sheet below. This helps with the 'volatile function' issue mentioned above as =TODAY() only needs to be calculated once. I have then used a couple of extra helper cells in column K and made a suggestion for a new formula for column H. (Note that I get a different result to you for row 4, as did jbeaucaire. I am assuming you just made a mistake with your sample data there?)

- If not, and maybe you don't really need some of the other columns either, I have made a different suggestion in the bottom section of my sheet below.

All formulas that I have shown for columns A:H are copied down in their respective sections of the sheet (note the limited number of actual formulas shown below - refer point 1 above).

Excel Workbook
ABCDEFGHIJK
1NowMonthInvoice DateInvoice MonthInvoice QtrYearValueLabelToday10/02/2009
210/02/2009205/01/20091120092009Q1Current QuarterCurrent Qtr End31/03/2009
310/02/2009215/12/200812420082008Q4Last QuarterLast Qtr End31/12/2008
410/02/2009201/11/200811420082008Q4Last Quarter
510/02/2009222/09/20089320082008Q32008Q3
610/02/2009205/06/20086220082008Q22008Q2
710/02/2009214/02/20082120082008Q12008Q1
8
9
10Invoice DateInvoice Qtr EndValueLabelToday10/02/2009
1105/01/200931/03/20092009Q1Current QuarterCurrent Qtr End31/03/2009
1215/12/200831/12/20082008Q4Last QuarterLast Qtr End31/12/2008
1301/11/200831/12/20082008Q4Last Quarter
1422/09/200830/09/20082008Q32008Q3
1505/06/200830/06/20082008Q22008Q2
1614/02/200831/03/20082008Q12008Q1
17
Quarters
 
Upvote 0

Forum statistics

Threads
1,223,104
Messages
6,170,125
Members
452,303
Latest member
c4cstore

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top