# Data into age buckets

#### gambils

##### Board Regular
I have a large list with one columns that have age, gender and race. I need to sort the gender and race into the following age groups:

17 and under
18-64
65-84
85 and older

All that comes to mind to me is to do an if statement where I look at the age column and say, for instance, if it says age 18 in cell A1 they go in the 18-64 bucket and I place that result in B1. I have not ever done an if formula with so many conditions before so want to make sure I do the formula correctly.

Thanks!

#### Fluff

##### MrExcel MVP, Moderator
=LOOKUP(A2,{0,18,65,85},{"17 and under","18-64","65-84","85 and older"})

#### gambils

##### Board Regular
=LOOKUP(A2,{0,18,65,85},{"17 and under","18-64","65-84","85 and older"})
I do not have the bracket character on my keyboard- perhaps some way to get to it?

#### Fluff

##### MrExcel MVP, Moderator
Must admit, I've never seen a keyboard that doesn't have the { or } braces. They're normally SHIFT [ and SHIFT ].

#### Fluff

##### MrExcel MVP, Moderator
You can use Alt 123 for { and Alt 125 for }
you will need to use the numbers on the number keypad.

#### gambils

##### Board Regular
You can use Alt 123 for { and Alt 125 for }
you will need to use the numbers on the number keypad.
None of my keyboards have the brackets but the work-around worked!

I also don't understand the formula but don't want to take up forum space to pursue that- for now I am just happy it works and will investigate later!

#### Fluff

##### MrExcel MVP, Moderator
The parts inside the {} are arrays, the function looksup the value of A2 in the first array & returns the corresponding value from the 2nd array.
If no exact match is found it uses the nearest lower value.

HTH

#### gambils

##### Board Regular
The parts inside the {} are arrays, the function looksup the value of A2 in the first array & returns the corresponding value from the 2nd array.
If no exact match is found it uses the nearest lower value.

HTH
Thanks! Have never used arrays before. And, BTW, the old man with bad eyes located the brackets on his keyboard! Still the alt 123 and alt 125 was fun to learn!

#### Fluff

##### MrExcel MVP, Moderator
Glad to help & thanks for the feedback

1,082,139
Messages
5,363,363
Members
400,731
Latest member
Jackserver

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...