|  

» Using the COUNT Functions

Problem:

How can we count the cells in List1 (column A) according to the following criteria:
1. Cell contains a number.
2. Cell is not empty.
3. Cell is empty.
4. Cell contains a number larger than 5.
5. Cell contains text.
6. Cell contains the string "Excel".
7. Cell contains 3 characters only.

Solution:

Use the COUNT, COUNTA, COUNTBLANK, and COUNTIF functions as shown in the following formulas:
1. =COUNT(A2:A13)
2. =COUNTA(A2:A13)
3. =COUNTBLANK(A2:A13)
4. =COUNTIF(A2:A13,">5")
5. =COUNTIF(A2:A13,"*")
6. =COUNTIF(A2:A13,"*Excel*")
7. =COUNTIF(A2:A13,"???")


To replace the criteria specified in the COUNTIF function with a cell reference containing the desired criteria, include the following operators: <, >, and = within quotation marks and use the "&" operator to join (concatenate) them with the cell reference.
The same method can be applied when using the "*" operator (wildcard) to count cells containing a particular substring.
Thus, with the information stored in C11:C14, the above COUNTIF functions (4-7) could be modified, as follows:
1. =COUNTIF(A2:A13,">"&C11)
2. =COUNTIF(A2:A13,C12)
3. =COUNTIF(A3:A13,"*"&C13&"*")
4. =COUNTIF(A2:A13,C14)


Rate This Tip
12 34 5
Rating: 3.84     Views: 42508
using vlookup but returning a zero value if nothing found
Neil Green
I wonder if someone could help me, I am using a VLOOKUP function to find a number / value in a pivot table and return that value in the cell. However I want it to return 0 (zero) if there is no number / value in the table.
I have in the past used COUNTIF function and it has worked but now it keeps giving me a #VALUE! - i have tried changing the formats so that all text is TEXT and all numbers are NUMBERS etc. but this doesnt seem to correct the problem.
I think it is something simple but for the life of me cant work out what it is!!


This is the formula I am using, column A is a code (in TEXT) and B is a total in stock.
=IF(COUNTIF(Pivot!$A$1:$B$5,A1),VLOOKUP(Pivot!$A$1:$B$5,A1,2,FALSE),0)

I would appreciate any help.

Thanks in advance


Neil
daddylonglegs
Try

=IF(COUNTIF(Pivot!$A$1:$A$5,A1),VLOOKUP(A1, Pivot!$A$1:$B$5,2,FALSE),0)
Click here to post comment
For Registered Users
Name
Comment Title
Comments