Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Range Grouping 1

Status
Not open for further replies.

EMVIC

MIS
Jul 29, 2006
12
GB
Could someone pls assist?
Below is snap shot of my data

EnrolmentDate DOB Age_Range
30/09/1990 12/10/1961
09/02/1991 14/09/1970
18/07/2000 17/02/1972
17/03/1996 19/07/1975

My intended output is to have a column named Age Range which will be grouped based on {EnrolmentDate-DOB}. How can I group the outcome of {EnrolmentDate-DOB} to fall within these ranges:
< 20, 20-24, 25-34, 35-44, 45+. I’m currently using CR9 and DB is SQL server 2000
 
Hi there

You can create a formula such as

Code:
Select {Age Range}
    Case < 20 :
        1
    Case 21 To 24 :
        2
    Case 25 To 34 :
        3
    Case 35 To 44 :
        4
    Case >= 45 :
        5

You can then group by this formula.

Hope this helps


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
First step would be to create calculate the difference between DoB & EnrolmentDate. Create a formula called "Age"
datediff ("yyyy", {DOB}, {EnrolmentDate})

Then you can convert the age into a range with a series of IF statements. Create a formula called "Age Range":

IF {@Age} < 20 THEN "< 20" ELSE
IF {@Age} in 20 to 24 THEN "20-24" ELSE
IF {@Age} in 25 to 34 THEN "25-34" ELSE
IF {@Age} in 35 to 44 THEN "35-44" ELSE
"45+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top