Other Links

 

 

Tutorial on VBA for Excel (macros)

This is one of the 30 lessons from the
Tutorial on Excel Formulas


Lesson 3-18B: COUNTIF Function

The general format for the COUNTIF formula is as follow: =COUNTIF(range where criteria applies, criteria)
Applied to the table below, the result of the following  formulas shoule be 3:
=COUNTIF(C2:C7,"John")
or
=COUNTIF(C2:C7,C2)

 

A

B

C

D

1

Month

State

Name

Amount

2

May

MI

John

2

3

Jun

NY

Peter

6

4

Mar

PA

John

8

5

Dec

NH

Peter

3

6

Nov

RI

John

4

7

Oct

FL

Peter

6

The COUNTIF function is limited to one criteria (one column). If you want to count the amounts based on month, State and name, discover the very simple SUMPRODUCT function with which you can use 2, 3 or more criteria with "or" ,  "and" ...SUMPRODUCT is like COUNTIF on steroids