COUNTIF

G

Guest

Let's say I have a range of data from A1:A25 and I want to use the COUNTIF
function to count how many times 2 different conditions fall within this
range. The conditions are "Red" and "Blue" - What would the formula be? I'm
assuming I use the COUNTIF function.

ANY help would be greatly appreciated, Karen
 
D

Dave Peterson

And these are the words Red and Blue--not the actual colors, right?

=sum(countif(a1:a25,{"Red","Blue"}))

or you could each separately:

=countif(a1:a25,"Red") + countif(a1:a25,"blue")
 
G

Guest

Hi Karen

In the cell where you want result to be type...

If you want the individual total..

=COUNTIF(A1:A25,"Red")

In next another totla cell =COUNTIF(A1:A25,"Blue")

Or together

=COUNTIF(A1:A25,"Red")+COUNTIF(A1:A25,"Blue")

Hope this helps,

Gav.
 
D

domenic22

Let's say I have a range of data from A1:A25 and I want to use the COUNTIF
function to count how many times 2 different conditions fall within this
range. The conditions are "Red" and "Blue" - What would the formula be? I'm
assuming I use the COUNTIF function.

ANY help would be greatly appreciated, Karen

Try...

=COUNTIF(A1:A25,"Red")+COUNTIF(A1:A25,"Blue")

or

=SUM(COUNTIF(A1:A25,{"Red","Blue"}))

Hope this helps!
 
G

Guest

Thank you for your help
Karen

Dave Peterson said:
And these are the words Red and Blue--not the actual colors, right?

=sum(countif(a1:a25,{"Red","Blue"}))

or you could each separately:

=countif(a1:a25,"Red") + countif(a1:a25,"blue")
 
G

Guest

Thank you for your help
Karen


Gav123 said:
Hi Karen

In the cell where you want result to be type...

If you want the individual total..

=COUNTIF(A1:A25,"Red")

In next another totla cell =COUNTIF(A1:A25,"Blue")

Or together

=COUNTIF(A1:A25,"Red")+COUNTIF(A1:A25,"Blue")

Hope this helps,

Gav.
 
G

Guest

Yes, these are the words
Thanks

Dave Peterson said:
And these are the words Red and Blue--not the actual colors, right?

=sum(countif(a1:a25,{"Red","Blue"}))

or you could each separately:

=countif(a1:a25,"Red") + countif(a1:a25,"blue")
 
D

Dave Peterson

That didn't work for me.

I bet you meant:
=SUM(COUNTIF(A1:A25,{"Red","Blue"}))
(not an array formula)
 
A

Alan Beban

Gary''s Student said:
=COUNTIF(A1:A25,"Red")
=COUNTIF(A1:A25,"Blue")
Or simply =COUNTIF(A1:A25,{"Red","Blue"}) array entered into a
two-column row.

Alan Beban
 
A

Alan Beban

No; I meant =COUNTIF(A1:A25,{"Red","Blue"}) array entered. :)

Excel 2002. What version are you using?

Note that I was responding to Gary's Student (who was proposing one
result for each color), not proposing a formula to return the sum.

Regards,
Alan
 
D

Dave Peterson

xl2003.

If I select the cell and highlight the formula in the formulabar, then hit F9, I
see:
={2,1}

with two Red's and one Blue in A1:A25

If there are no Red's in the range, I see 0 in the cell.

If I do the same thing (evaluate the formula), I see:
={0,1}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top