SOLVED

Excel COUNTIF function not counting correctly

Copper Contributor

I've been using a sheet for a long time. Suddenly today, a simple COUNTIF function doesn't work any more. The formula is as simple as they get: =COUNTIF(AC23:SZ23,"L"). There are numerous 'L's in the row, yet it returns 1.

 

There are many other such countif functions counting data in the same row, such as =COUNTIF(AC23:SZ23,"FDO"), which works perfectly. It looks at exactly the same data set, formatted in exactly the same manner. The cells are all 'general'.

 

What can be wrong?

4 Replies
best response confirmed by J_Uys123 (Copper Contributor)
Solution
There might be L’s with leading and trailing spaces. Try this:
=SUMPRODUCT(—(TRIM(AC23:SZ23)=“L”))

@Twifoo 

 

This formula works, thanks.

 

I checked, and there were training spaces behind the 'L's. Upon investigation it turns out that my staff member typed in 'leave' and then corrected it afterwards. Excel let the word 'leave' reappear when he tried typing in 'L', so he made a space to get the 'L'. And that 'incapacitated' my formula.

You’re welcome!
My counties not counting
I used = counties(Gender, male, GPA,''>''&3.2) I have been working on it for some hours I could not get what I want?
1 best response

Accepted Solutions
best response confirmed by J_Uys123 (Copper Contributor)
Solution
There might be L’s with leading and trailing spaces. Try this:
=SUMPRODUCT(—(TRIM(AC23:SZ23)=“L”))

View solution in original post