Count dates in next quarter / multiple years

sparkytech

Board Regular
Joined
Mar 6, 2018
Messages
96
Office Version
  1. 365
  2. 2019
I am trying to count multi-year dates in N5:N1500 that occur in the next quarter only. Starting at BA5 in column BA5:BA1500, I have the following typical formula:

Excel Formula:
=IF(AND(O5="",N5>=TODAY(),N5<>""),(ROUNDUP(MONTH(N5)/3,0)),"")

This checks to see if the date in N5 is greater or equal to today and that O5 does not contain a date, and then displays the quarter of the N5 date in BA5. I also have the following formula to calculate the total cells in column BA that match the next quarter:

Excel Formula:
=COUNTIF(BA5:BA1500,(ROUNDUP(MONTH(TODAY())/3,0)+1))

The problem I have is since the dates in Column "N" span multiple years, any dates occurring in a quarter are counted for this year, and also future years (i.e: any dates occurring in Q3 are counted for 2021, 2022, 2023, etc.). How can I remedy this? My end goal is to look at N5:N1500 and total any dates occurring in the next quater. Thanks in advance!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Sparkytech,

Why not just add the year as a part of the BA column?

Sparkytech.xlsx
NOPQAZBA
3Count=3
4DatesOblankCheck
507-Aug-212021 3
609-Sep-212021 3
701-Aug-212021 3
804-Sep-242024 3
907-Jun-232023 2
1012-Feb-21 
1108-Aug-21Not 
1211-Feb-242024 1
1320-Feb-21 
1402-Jun-222022 2
1522-Sep-262026 3
1619-Apr-222022 2
Sheet1
Cell Formulas
RangeFormula
Q3Q3=COUNTIF(BA5:BA1500,(YEAR(TODAY())&" "&ROUNDUP(MONTH(TODAY())/3,0)))
BA5:BA16BA5=IF(AND(O5="",N5>=TODAY(),N5<>""),YEAR(N5)&" "&(ROUNDUP(MONTH(N5)/3,0)),"")
 
Upvote 0
Hi Sparkytech,

Why not just add the year as a part of the BA column?

Sparkytech.xlsx
NOPQAZBA
3Count=3
4DatesOblankCheck
507-Aug-212021 3
609-Sep-212021 3
701-Aug-212021 3
804-Sep-242024 3
907-Jun-232023 2
1012-Feb-21 
1108-Aug-21Not 
1211-Feb-242024 1
1320-Feb-21 
1402-Jun-222022 2
1522-Sep-262026 3
1619-Apr-222022 2
Sheet1
Cell Formulas
RangeFormula
Q3Q3=COUNTIF(BA5:BA1500,(YEAR(TODAY())&" "&ROUNDUP(MONTH(TODAY())/3,0)))
BA5:BA16BA5=IF(AND(O5="",N5>=TODAY(),N5<>""),YEAR(N5)&" "&(ROUNDUP(MONTH(N5)/3,0)),"")
Thanks for the suggestion! Will that work when todays date is in Q4, to count Q1 dates of the following year?
 
Upvote 0
Ah! I missed the count was for next quarter dates.

Here, this should work for you.

Sparkytech.xlsx
NOPQAZBA
3Count=4
4DatesOblankCheck
507-Oct-212021 4
609-Sep-212021 3
701-Aug-212021 3
804-Sep-222022 3
907-Jun-232023 2
1012-Feb-21 
1108-Aug-21Not 
1211-Nov-212021 4
1320-Feb-21 
1401-Jan-232023 1
1511-Nov-212021 4
1631-Dec-212021 4
Sheet1
Cell Formulas
RangeFormula
Q3Q3=COUNTIF(BA5:BA1500,YEAR(TODAY())+INT(MONTH(TODAY())/10)&" "&INDEX({2,2,2,3,3,3,4,4,4,1,1,1},MONTH(TODAY())))
BA5:BA16BA5=IF(AND(O5="",N5>=TODAY(),N5<>""),YEAR(N5)&" "&(ROUNDUP(MONTH(N5)/3,0)),"")
 
Upvote 0
...and here's a test version where cell Q1 has the date for TODAY so you can just overtype it to test for any date.

Sparkytech.xlsx
NOPQAZBA
1Today=7/13/2021
2
3Count=4
4DatesOblankCheck
507-Oct-212021 4
609-Sep-212021 3
701-Aug-212021 3
804-Sep-222022 3
907-Jun-232023 2
1012-Feb-21 
1108-Aug-21Not 
1211-Nov-212021 4
1320-Feb-21 
1401-Jan-232023 1
1511-Nov-212021 4
1631-Dec-212021 4
Sheet1 (2)
Cell Formulas
RangeFormula
Q1Q1=TODAY()
Q3Q3=COUNTIF(BA5:BA1500,YEAR($Q$1)+INT(MONTH($Q$1)/10)&" "&INDEX({2,2,2,3,3,3,4,4,4,1,1,1},MONTH($Q$1)))
BA5:BA16BA5=IF(AND(O5="",N5>=TODAY(),N5<>""),YEAR(N5)&" "&(ROUNDUP(MONTH(N5)/3,0)),"")
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,801
Members
449,337
Latest member
BBV123

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