creating a form

R

reportyemi

I have a column for patients age on a form that i am creating but during
analysis/ reporting I want to report total number of patints ages in age
ranges like below

10-14;15-19;20-24;25 - 29;30- 34;35 - 39 and so on
no of patients 3 5 54 76 43 21
that is 3 patients had ages between 10 and 14 ..and so on

how can i do this

yemi
 
M

MGFoster

reportyemi said:
I have a column for patients age on a form that i am creating but during
analysis/ reporting I want to report total number of patints ages in age
ranges like below

10-14;15-19;20-24;25 - 29;30- 34;35 - 39 and so on
no of patients 3 5 54 76 43 21
that is 3 patients had ages between 10 and 14 ..and so on

how can i do this

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the Partition() function in the report's query, like this:

SELECT Partition(patient_age,10,89,5) As AgeRange, COUNT(*) As Patients,
... other columns, if any ...
FROM table_name
WHERE criteria.... etc. ...
GROUP BY Partition(patient_age,10,89,5)

The Partition() function returns a string like the following:

:10
10:14
15:19
20:24
25:29
.... etc. ...
90:

In the above example, I've set up the Partition() function to only work
on ages between 10 and 89. Every age below 10 will be represented as :9
(i.e., 9, or younger). Every age above 89 will be represented 90:
(i.e., 90, or older).

If you want more "human readable" partitions you could use this formula
(watch out for line wrap):

Replace(Replace(Replace(Partition(Age,10,89,5),":"," - ")," -
9","below 10"),"90 - ","90 and above")

, which means you'll have to put the same formula in the GROUP BY
clause.

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSlVxxIechKqOuFEgEQK/xgCggwxT8NrKr+Fc1GvkDFWXiJOGnuYAniH7
WYjWGKQUj01A+FhZ+AEimycK
=3Kyk
-----END PGP SIGNATURE-----
 

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