These functions count records based on conditions.

COUNTIF

Purpose

Counts cells that meet one condition.

Syntax

=COUNTIF(range,criteria)

Example

Student

Marks

Amit

85

Neha

35

Rahul

72

Priya

45

Simran

28

Count students scoring 40 or more:

=COUNTIF(B2:B6,”>=40″)

Result:

3

Text Example

=COUNTIF(C2:C10,”Sales”)

Counts employees belonging to the Sales department.

COUNTIFS

Counts records that meet multiple conditions.

Syntax

=COUNTIFS(range1,criteria1,range2,criteria2,…)

Example

Employee

Department

Sales

Amit

Sales

85000

Neha

HR

45000

Rahul

Sales

120000

Priya

Sales

95000

Simran

HR

55000

Count Sales employees with sales of ₹80,000 or more:

=COUNTIFS(B2:B6,”Sales”,C2:C6,”>=80000″)

Result:

3

Practice

Create an Employee Analysis sheet and count:

  • Sales employees
  • Employees with salary above ₹40,000
  • Sales employees with sales above ₹80,000