Data into age buckets

gambils

Board Regular
Joined
Apr 22, 2009
Messages
241
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
Joined
Jun 12, 2014
Messages
32,270
Office Version
365
Platform
Windows
How about
=LOOKUP(A2,{0,18,65,85},{"17 and under","18-64","65-84","85 and older"})
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,270
Office Version
365
Platform
Windows
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
Joined
Jun 12, 2014
Messages
32,270
Office Version
365
Platform
Windows
You can use Alt 123 for { and Alt 125 for }
you will need to use the numbers on the number keypad.
 

gambils

Board Regular
Joined
Apr 22, 2009
Messages
241
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
Joined
Jun 12, 2014
Messages
32,270
Office Version
365
Platform
Windows
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
Joined
Apr 22, 2009
Messages
241
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
Joined
Jun 12, 2014
Messages
32,270
Office Version
365
Platform
Windows
Glad to help & thanks for the feedback
 

Forum statistics

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

Some videos you may like

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...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top