ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   coutif problem (https://www.excelbanter.com/new-users-excel/102866-coutif-problem.html)

hsb101

coutif problem
 

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

hope someone can help


--
hsb101
------------------------------------------------------------------------
hsb101's Profile: http://www.excelforum.com/member.php...o&userid=37049
View this thread: http://www.excelforum.com/showthread...hreadid=567749


Biff

coutif problem
 
Hi!

Try this:

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

Biff

"hsb101" wrote in
message ...

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

hope someone can help


--
hsb101
------------------------------------------------------------------------
hsb101's Profile:
http://www.excelforum.com/member.php...o&userid=37049
View this thread: http://www.excelforum.com/showthread...hreadid=567749




hsb101

coutif problem
 

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?


--
hsb101
------------------------------------------------------------------------
hsb101's Profile: http://www.excelforum.com/member.php...o&userid=37049
View this thread: http://www.excelforum.com/showthread...hreadid=567749


Biff

coutif problem
 
"hsb101" wrote...
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




All times are GMT +1. The time now is 09:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com