MisterCrash
Active Member
- Joined
- Jan 27, 2003
- Messages
- 279
I have a database of people, and I run a query that groups people by age and counts the number of people that are at a particular age. The results of this are then pasted into an Excel spreadsheet, which performs various calculations based on the age.
However, some age groups are not represented in the database (for example, there are no 61-year-olds), and the output from Access has no entry for these ages. I would greatly prefer it if Age 61 did show up in the query result, but would have a value of zero (otherwise, I have to reconfigure the Excel sheet every time the last person leaves an age group or the first person goes into a previously vacant age group).
The solution I have been using is to create a dummy table (with the field [TableAge]) that lists the range of ages I'm interested in, then calculates the number of people of that age by:
=IIF([Age]=[TableAge], [CountOfMemberID], 0)
However, this seems computationally cumbersome, and I wondered if Access had a simpler means of accomplishing this feat. Thank you!
However, some age groups are not represented in the database (for example, there are no 61-year-olds), and the output from Access has no entry for these ages. I would greatly prefer it if Age 61 did show up in the query result, but would have a value of zero (otherwise, I have to reconfigure the Excel sheet every time the last person leaves an age group or the first person goes into a previously vacant age group).
The solution I have been using is to create a dummy table (with the field [TableAge]) that lists the range of ages I'm interested in, then calculates the number of people of that age by:
=IIF([Age]=[TableAge], [CountOfMemberID], 0)
However, this seems computationally cumbersome, and I wondered if Access had a simpler means of accomplishing this feat. Thank you!