coutif problem

  • Thread starter Thread starter hsb101
  • Start date Start date
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
 
Hi!

Try this:

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

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 sam
as the true value
 
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
 
Back
Top