How to count the number of years in a set of data

Geekersw

New Member
Joined
Oct 18, 2023
Messages
4
Hello all,

I have a set of payment dates (month and year), and want to be able to count how many payment were made during a specific year. I tried Countif function but cannot make it to work.

Which formula can I best use to count the number of payments in a certain year, for example 2026 (months in a year are not relevant)?
Thank you very much

1697606514176.png
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Great, this works! What if I want to be more granular, for example only aim for Q1 2026 payments, how can I insert that in this formula?

Many thanks!
 
Upvote 0
This will check for Q4 2016
Excel Formula:
=SUMPRODUCT((YEAR(A:A)=2026)*(ROUNDUP(MONTH(A:A)/3,0)=4))
Since SUMPRODUCT is an array function in its nature, I would not recommend using A:A reference completely. It will be a better practice to limit it like A1:A10000
 
Upvote 0
Wow that looks complex. Would you mind briefly explaining how this formula would check for A4 2026, so that I can reproduce it for other quarters? Thanks a lot!
 
Upvote 0
I didn't get your question sorry.
(YEAR(A:A)=2026) This part checks if the range equals to year
(ROUNDUP(MONTH(A:A)/3,0)=4) This part checks if the date belongs to 4th quarter.

Then it multiplies TRUE results. Multiplication converts the TRUE values into 1 and False values into 0. Then SUMPRODUCT function sums them.
 
Upvote 0
Why not compare with specific date:
Book2
ABCDEF
101-Jan-202320237=SUMPRODUCT(--(YEAR($A$1:$A$8)=D1))
202-Oct-2023Q1-20234=COUNTIFS($A$1:$A$8,">="&DATE(2023,1,1),$A$1:$A$8,"<"&DATE(2023,4,1))
306-Dec-2024Q4-20231=COUNTIFS($A$1:$A$8,">="&DATE(2023,10,1),$A$1:$A$8,"<"&DATE(2024,1,1))
407-Mar-2023
505-Feb-2023
605-Apr-2023
705-Jun-2023
805-Feb-2023
9
Sheet1
Cell Formulas
RangeFormula
E1E1=SUMPRODUCT(--(YEAR($A$1:$A$8)=D1))
E2E2=COUNTIFS($A$1:$A$8,">="&DATE(2023,1,1),$A$1:$A$8,"<"&DATE(2023,4,1))
E3E3=COUNTIFS($A$1:$A$8,">="&DATE(2023,10,1),$A$1:$A$8,"<"&DATE(2024,1,1))
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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