Video extract as seen on YouTube, plus extended tutorial below.
|Click the Full Screen button on the player to watch it in HD.|
In this Microsoft Office tutorial we’re looking at the COUNTIF and COUNTIFS Formulas, and we’ll take a look at a couple of different applications for them.
Plus download a practice workbook so you can learn by reverse engineering the formulas used in this example. Note: this is an Excel .xlsx workbook. Please ensure your browser doesn’t change the file extension on download.
The COUNTIF extends the capabilities of the basic COUNT formula by allowing you to tell Excel to only COUNT items that meet a certain criteria. New in Excel 2007 is the COUNTIFS formula, which allows you to stipulate multiple criteria, hence the plural.
Enough explanation, let’s dive into an example as it’s easier to visualise.
The function wizard in Excel describes the COUNTIF Formula as:
Looks fairly simple and it is. Let’s translate it into English now by applying it to an example. Say we wanted to count the number of times Dave appeared in column C of the table below.
Translated our formula would read like this:
=COUNTIF(count the number of cells in column C, that contain 'Dave')
We could even create a table under the data to count the occurrences of each builder:
Our formula in cell C12 would be:
While the above formula is good, if we were to copy it to the rest of the summary table (cells C11 to C14) we would have to manually change the cell references and builder’s name to get the correct answers.
To avoid this manual intervention, we can use absolute references, which will speed up the process of copying the formula to the remainder of column C.
With absolute references our formula would look like this:
The ‘$’ signs tell Excel that we don’t want the reference after the ‘$’ sign to change when we copy the formula. For example, if we copied the formula into cell C13 it would read:
In the above formula we can see that the only reference that changed was $B12, which became $B13.
The best way to understand how this works is to try it for yourself. Download the workbook used in this example here.
Note: this is an Excel .xlsx workbook. Please ensure your browser doesn’t change the file extension on download.
Note: I used a basic example to illustrate how to use the COUNTIF formula, but you could also achieve this count by builder using the subtotal tool in the Data tab.
The function wizard in Excel describes the COUNTIFS Formula as:
=COUNTIFS(critera_range_1,criteria_1,criteria_range_2,criteria_2.....and so on if required)
Extending the previous COUNTIF example above, say we wanted to only summarise the data by builder for jobs in the South region. We could use the COUNTIFS formula, as it allows us to set more than one condition.
Here’s how the formula would be interpreted if we wanted to count the occurrences of Brian in column C, where jobs were in the South region:
=COUNTIFS(count the number of cells in column C if, they contain ‘Brian’ and, if in column B, they are also for the South region)
Note: Excel will only include the cells in column C in the count when both conditions (Brian & South) are met.
Using absolute references, our formula in Excel cell C20 would read:
Try other operators
Other operators you could use are:
- = Equal to
- < Less Than
- > Greater Than
- <= Less than or equal to
- >= Greater than or equal to
- <> Less than or greater than
For example, if you wanted to count the jobs with an average > $300k the formula would be:
Note: again I’ve used a simple example to illustrate this formula, but another way to achieve this summary table for each builder by region is to use a Pivot Table.
Want to Learn More Excel Formulas
Why not visit our list of Excel formulas. You’ll find a huge range all explained in plain English, plus PivotTables and other Excel tools and tricks. Enjoy
Spread the Word
If you found this useful please share it with your friends and colleagues using the Google+1, LinkedIn, Facebook and Twitter buttons.