w3resource

Excel Formulas - Count cells for equality

Count cells for equality

Count cells for equality

Syntax of used function(s)

COUNTIF(criteria_range, criteria)

The COUNTIF function is used to count the number of cells that meet a certain criteria.

Explanation

To count the number of cell is equal to the supplied criteria. In the following example, F8 contains this formula.


=COUNTIF(D5:D10,"Male")

How this formula works

In the above example the range D5:D10 contains the sex of the employees and the criteria "Mail" will search in the range D5:D10 and counts the number of times it found.

Count cells for equality using range name and criteria variable

Count cells for equality using range name and criteria variable

Explanation

To count the number of cell is equal to the supplied criteria variable which contains the criteria value. In the following example, G8 contains this formula.

Formula


=COUNTIF(Sex,F8)

How this formula works

In the above example the range D5:D10 contains the sex of the employees named as "Sex" and the criteria variable F8 may contain the value "Mail". Therefore criteria will search in the range name "Sex" and counts the number of times it found.

Previous: Excel Formulas - Count number of cells that contain specific number of characters
Next: Excel Formulas - Count number of cells which are not blank using COUNTA()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/excel/formulas/count/count-cells-for-equality.php