Bring Back a Count of a Number Range Based on Values in Another Cell

Grimlocc

New Member
Joined
Aug 4, 2017
Messages
20
Hello,

I am struggling with which formula can help me with this so I am coming to you for some help. I have tried to do a COUNTIFS(AND formula but I don’t even know whether that’s a valid combination… I have thought that it may need an index match but I don’t know how to do those, I can only do simple vlookups unfortunately.

My problem is this: I wish to bring back data from one column based on data from another column into a third column. I am doing this so that I can quickly view the age ranges of staff based in each location.

On one sheet (SHEET 1), I have a large data set relating to my staff. One column holds the location they are based in and another column I have the age of each member of staff.

On another sheet (SHEET 2), I have columns for each location and I wish to be able to indicate an age range on the rows below the location. Below is an example of what SHEET2 looks like:

Column B | Column C | Column D | Column E | Column F
Location 1 Location 2 Location 3 Location 4 Location 5
Row 3 20-30
Row 4 30-40
Row 5 40-50
Row 6 50-60
Row 7 60+

SHEET 1 simply has columns with data in them – please see below how it looks. There are lots of columns in between the LOCATION and AGE on my actual spreadsheet but I don’t need any of them for this:

Column A | Column B
Location | Age

Location 1 30
Location 2 45
Location 3 40
Location 1 25
Location 1 60
Location 2 43
Location 5 34
Location 3 39
Location 4 49
Location 2 51
Location 1 39
Location 5 40

And so on…

So, there are a number of different locations in column A and there are multiple staff working at each location. Is it possible to have a formula in SHEET 2 in cell B3 that will look in Column A on SHEET 1 for all of the instances of Location 1 then when it finds them, looks across to column B and counts the number of people with an age between 20 and 30 and gives me the number of people at that location in that age range? Then, in cell B4 on SHEET 2, do the same thing but for the age range 30-40 and so on?

I hope that I’ve managed to explain myself clearly and thank you in advance for any help you can give me!
 
Last edited:

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,)
this assume age 30 belongs to the 30-40 group etc, adjust to suit


Excel 2013/2016
ABCDEFGHIJ
1LocationAgeLocation 1Location 2Location 3Location 4Location 5
2Location 130203010000
3Location 245304020101
4Location 340405002111
5Location 125506001000
6Location 160609910000
7Location 243
8Location 534
9Location 339
10Location 449
11Location 251
12Location 139
13Location 540
229
Cell Formulas
RangeFormula
F2=COUNTIFS($A$2:$A$13,F$1,$B$2:$B$13,">="&$D2,$B$2:$B$13,"<"&$E2)
 
Upvote 0

Forum statistics

Threads
1,215,513
Messages
6,125,256
Members
449,219
Latest member
daynle

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