# Thread: Using COUNTIF with multiple criteria

1. ## Using COUNTIF with multiple criteria

I am needing to use COUNTIF to count ages. I have a spreadsheet that calculates ages, but now I need to count how many people are between 0-10, between 10-20, and so on and so forth. I have figured it out this far =COUNTIF(A1:a122,"<10"), but that is only for less than ten. What kind of formula do I use to figure out >10<20?

2. =COUNTIF(A1:a122,"<20") -COUNTIF(A1:a122,"<10")

Steve

3. I don't know what I'm doing wrong, but that isn't working. Being as there are only 122 records, I just counted them for the job I needed, but I'd still like to figure it out. I have the spreadsheet attached. That formula was giving me weird numbers. Between 10 and 20 there are actually 24 people, but that formula gives me 20.

4. The formula you have is
=COUNTIF(A1:A122,">9")-COUNTIF(A1:A122,"<20")

is not the one I gave you and is not what you asked about. The one I gave:
=COUNTIF(A1:A122,"<20")-COUNTIF(A1:A122,"<10")

Gives 24...

[The first countif counts everything <20 (including all those <10). The 2nd subtracts out the ones <10. ]

Steve

5. I think first of all the bracket ranges need to changed. For example 10-20 and 20-30 would double count the 20's. 20 would be counted in 10-20 and 20 would be counted in 20-30.

The attached uses the COUNTIFS function. That function is not available in Excel 2003.

Look at Rows 4 and 5.

HTH

6. Row 6 of this version uses COUNTIF and can be used with earlier versions of Excel.

7. OK. Thanks for the explanation. It didn't make sense to me so I changed it around, now it all works.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•