coutif problem

H

hsb101

i have a list of names in one worksheet, i used a countif formula t
count the number of names - but how do i replace the zero when a dat
is not found to somethin else such as 'error' or 'not found'??

hope someone can hel
 
B

Biff

Hi!

Try this:

=IF(COUNTIF(A1:A10,"some_name"),COUNTIF(A1:A10,"some_name"),"Not Found")

Biff
 
H

hsb101

i got it i think...i just used this formula...

=IF(COUNTIF(A4:B45,D7),COUNTIF(A4:B45,D7),"Not Found")

why does this formula work when i use the logical test being the sam
as the true value
 
B

Biff

i got it i think...i just used this formula...
=IF(COUNTIF(A4:B45,D7),COUNTIF(A4:B45,D7),"Not Found")
why does this formula work when i use the logical test being the same
as the true value?

The logical test: COUNTIF(A4:B45,D7), will return a number, either 0 or some
number greater than 0.

When it returns 0 the logical test evaluates to FALSE and the formula
returns "Not Found".

When the logical test returns ANY number other than 0 then the logical test
evaluates to TRUE and performs the second Countif.

It can also be expressed as:

=IF(COUNTIF(A4:B45,D7)>0,COUNTIF(A4:B45,D7),"Not Found")

But my version saves 2 keystrokes and and 1 evaluation step! <g>

Biff
 

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