Age Group Calculation

R

Rose

I would like count the number of clients in my table that fall into the
following age groups in my query or report. 62 and over, 51-61, 31-50,
18-30, 13-17, 6-12, 1-5, Under 1. I currently run 8 queries with the count
feature using Age Criteria changing each time and based off of the Birthdates
statement Age:((DateDiff(“dâ€,[Birthdate],Now())\365.25))). Any ideas on how
this can be done in one report if I display all clients and write
calculations on the bottom our report or somehow group them?
 
K

krissco

I would like count the number of clients in my table that fall into the
following age groups in my query or report. 62 and over, 51-61, 31-50,
18-30, 13-17, 6-12, 1-5, Under 1. I currently run 8 queries with the count
feature using Age Criteria changing each time and based off of the Birthdates
statement Age:((DateDiff("d",[Birthdate],Now())\365.25))). Any ideas on how
this can be done in one report if I display all clients and write
calculations on the bottom our report or somehow group them?

If you want to group/display your records by age group, change your
query like so:

select . . ., iif(Age < 1, "Group1", iif(Age<6, "Group2", iif(Age<18,
"Group3", iif(Age<31, "Group4", iif(Age<51, "Group5", iif(Age<62,
"Group6", "Group7")))))) as AgeGroup, . . .
from . . .


If all you want is the count of persons in an age group, add text
boxes to the report footer with control sources similar to:

=Sum(iif(Age<1, 1, 0))
=Sum(iif(Age>=1 and Age<=5, 1, 0))
=Sum(iif(Age>=6 and Age <=12, 1, 0))
.. . .


On a side note:
Does your data include any persons that were living during a year
divisible by 100, but not divisible by 400 (1800, 1900, 2100, etc.)?
If so, your formula for their age may not work correctly on/around
their birthday.

-Kris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top