problem (maybe simple) displaying certain text

  • Thread starter Thread starter Squalle
  • Start date Start date
S

Squalle

Hi all,

This maybe a simple fix, but I cannot seem to get it.

I have a range, let's say A3:A30, each containing a 1 or 0. I would like to
have a cell show how many 1's and how many 0's in the following format:
(x-y) where x =1's and y = 0's. Any ideas?

I tried using =COUNTIF(A3:A30,"1") in a cell and =COUNTIF(A3:A30,"0") in
another, then displaying those numbers in a cell, but that didn't work
either. Any ideas?

Thanks,

Rick
 
how about this in the cell

="(" & COUNTIF(A3:A30,"1")&"- "&COUNTIF(A3:A30,"0")&")"
 
Basically should work.
I just tried =COUNTIF(A3:A30,1)-COUNTIF(A3:A30,0)
No problems.

Cheers,

Joerg
 
Your formula is set to count if the string 0 or string 1 is in the cell
range

Try using =COUNTIF(A3:A30,1) and =COUNTIF(A3:A30,0)

Then subtract one from the other e.g.

=COUNTIF(A3:A30,1) - COUNTIF(A3:A30,0)
 
Thanks All,

Gary got it. It was the "&" that I was missing. I, for some reason, was
trying to use "+".
Too much PERL programming lately...

Thanks Gary!

Rick
 

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

Back
Top