Using COUNTIF to find number of accounts in an age group

Leah T.

New Member
Joined
Jun 29, 2007
Messages
4
Hello,

I have a spreadsheet listing the dates (cells e4:e37) that our accounts opened. I would like to know how many of those accounts are more than 10 years old, and how many are 10 years old or younger. This needs to be based on today's date (not a static date). I do not need to know the "age" of the account, just the total number in each age group.

I tried to use the COUNTIF function, but kept getting an error or "0" (which is not correct).

I was working on variations of this idea:

=COUNTIF(e4:e37,"<= 10 years ago")

but haven't been able to make it work.

Am I misusing COUNTIF? Is there another way to calculate the number of accounts in each age group?

Thanks,

Leah T.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Welcome to the board.

Assuming E4:E37 store Excel dates, try:

Code:
=COUNTIF(E4:E37,"<="&DATE(YEAR(TODAY())-10,MONTH(TODAY()),DAY(TODAY())))
 
Upvote 0
Welcome to the board, try this

=COUNTIF(E4:E37,"<="&DATE(YEAR(TODAY())-10,MONTH(TODAY()),DAY(TODAY())))
 
Upvote 0
or a shorter formula confirmed with CTRL + SHIFT + ENTER

=SUM(IF(DATEDIF(A1:A10,TODAY(),"y")>=10,1,0))

after pasting formula, highlight cell press F2, then press
CTRL + SHIFT + ENTER

This puts brackets {} around the formula.
 
Upvote 0
Aha! The COUNTIF formula worked! My brain was beginning to hurt trying to figure out where my logic was failing.

Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,381
Messages
6,124,615
Members
449,175
Latest member
Anniewonder

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