Data into age buckets

Status
Not open for further replies.

gambils

Active Member
Joined
Apr 22, 2009
Messages
260
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!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
How about
=LOOKUP(A2,{0,18,65,85},{"17 and under","18-64","65-84","85 and older"})
 
Upvote 0
Must admit, I've never seen a keyboard that doesn't have the { or } braces. They're normally SHIFT [ and SHIFT ].
 
Upvote 0
You can use Alt 123 for { and Alt 125 for }
you will need to use the numbers on the number keypad.
 
Upvote 0
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! :)
 
Upvote 0
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
 
Upvote 0
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!
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top