Countif

M

M.A.Tyler

Can you use a range of cells, A2:I25, that includes blank cells and still
count the instances of "apple"?
 
D

Dave Peterson

Sure.

=countif(a2:i25,"apple")
will still count the number of cells that equal Apple even if there are empty
cells in that range.

But I'm guessing that something isn't working for you.

Any chance you have extra spaces in those cells with Apple in them?
 
M

M.A.Tyler

No it's not working.
Not sure what you mean by extra spaces?
I've tryed the same formula you suggested except "apple" is J2, it gives me
an answer of 0, which is incorrect. thought it had something to do with the
empty cells?
 
J

Jay Emory

I believe Mr. Peterson is referring to leading or trailing spaces in the
cells containing "Apple" which could be visably obscured by cell formatting,
i.e. " Apple ", " Apple", or "Apple ", etc.
hth,
jay
 
S

Shane Devenshire

Hi,

Try

=COUNTIF(A2:I25,"*apple*")

Note that this will not count the following as 2 items

Red apples and green apples.

In that case it will count the entry once.
 
M

M.A.Tyler

There is some kind of trouble, I can get =countif(A2:G25) to work, but if I
add columns H and I it returns zero. Is there a way to check for extra
spaces, or some kind of formatting problem?
 
J

Jay Emory

How are you adding columns H and I? Does the cell with the countif function
change when you add the columns?

jay
 
Top