COUNTIFS not counting

IANWILLZ

New Member
Joined
Sep 12, 2019
Messages
6
Hi
I'm learning about COUNTIFS and I don't understand why this is working in one row and not another.

In my first cell in question My Criteria is TECH (E4) in Ranges A2 to A20 and R(G4) is ranges B2 to B20 :

I'm using =COUNTIFS($A2:$A20,$E4,$B2:$B20,G4) - and it seems to work, it counts 4 occurrences of R

On a different cell I want to count the following criteria BUS (E9) and R (G9)

=COUNTIFS($A2:$A20,$E9,$B2:$B20,G9) and it is not counting the Rs.

Can anyone shed light on this? Be gentle I am a beginner.

Thanks
Ian




OACColour
TECHR
TECHA
TECHGTECH(E4)RAG
TECHR422
TECHA
TECHG
TECHR
TECHRBUS(E9)RAG
BUSA000
BUSR
BUSA
BUSG
BUSR
BUSA
BUSG
BUSR
BUSG
BUSG
BUSA

<tbody>
</tbody>
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the Board!

I copied your data and formulas and it seems to work for me.

Try entering these two formula in any blank sheet and tell me what they return:
=LEN(E9)
=LEN(A10)
 
Last edited:
Upvote 0
Seems to work for me


Book1
ABCDEFGHI
1OACColour
2TECHR
3TECHA
4TECHGTECHRAG
5TECHR422
6TECHA
7TECHG
8TECHR
9TECHRBUSRAG
10BUSA344
11BUSR
12BUSA
13BUSG
14BUSR
15BUSA
16BUSG
17BUSR
18BUSG
19BUSG
20BUSA
Sheet4
Cell Formulas
RangeFormula
G5=COUNTIFS($A2:$A20,$E4,$B2:$B20,G4)
G10=COUNTIFS($A2:$A20,$E9,$B2:$B20,G9)


What if you try this in an empty cell
=COUNTIF(A2:A20,E9)

What does it return?
 
Upvote 0
Seems to work for me

ABCDEFGHI
1OACColour
2TECHR
3TECHA
4TECHGTECHRAG
5TECHR422
6TECHA
7TECHG
8TECHR
9TECHRBUSRAG
10BUSA344
11BUSR
12BUSA
13BUSG
14BUSR
15BUSA
16BUSG
17BUSR
18BUSG
19BUSG
20BUSA

<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
G5=COUNTIFS($A2:$A20,$E4,$B2:$B20,G4)
G10=COUNTIFS($A2:$A20,$E9,$B2:$B20,G9)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



What if you try this in an empty cell
=COUNTIF(A2:A20,E9)

What does it return?

Thank you. I just tried this It returns 0

If I change it to = COUNTIF(A2:A20,E4) it returns 8
 
Upvote 0
=LEN(E9) returns TRUE
=LEN (A10) returns 0
If that is true, then you have real problems, because according to your example, both E9 and A10 should have the string "BUS" in them, so they should both return a value of 3.
If they do not, then you have some issues somewhere (incorrect range references) and your formula will definitely not work, as written.
 
Upvote 0
Does E4 contain TECH or TECH(E4)
 
Upvote 0
LEN(A10) returns 4?
Sounds like you may have an extra space at the beginning or end of the entry in A10.
Note that it MUST match exactly. "BUS" does not equal "BUS ".
You can do Find/Replace on column A to quickly remove all spaces (replace a single space with nothing).
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,981
Members
448,538
Latest member
alex78

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