Calculate Percentage with Criteria in Excel (2 Useful Examples)

Get FREE Advanced Excel Exercises with Solutions!

In this Excel tutorial, you will learn 2 useful examples of calculating percentage with criteria. We will discuss how to use the IF function to calculate percentage with criteria in Excel. And then another advanced-level example where we will calculate the percentage of cells with a specific color in Excel.

Calculating percentages with criteria is commonly used in scenarios involving data analysis or financial modeling. For instance, you may need to determine the percentage of sales that meet a specific condition, such as products with sales exceeding a certain threshold. We can utilize functions like IF, COUNTIF, COUNTA, SUMIF, etc. to calculate percentages with criteria in Excel. Now let’s delve into the examples.


How to Use IF Function to Calculate Percentage with Criteria in Excel

Consider the following dataset where we have the sales volume of some employees for two consecutive months. We want to calculate the percentage of change in sales volume. However, if the change in sales volume is negative, we will assign the word “Decrease” instead of calculating the percentage change for that employee. To do this, we can apply the IF function.

Dataset for Calculating Percentage with IF Function

In cell E6, apply the following formula and press the Enter key=> set the Number Format of the cell to Percentage => drag down the Fill Handle icon to copy the formula in the remaining cells.

=IF(D6-C6>0,(D6-C6)/C6,"Decreased")

How to Use IF Function to Calculate Percentage with Criteria in Excel


How to Calculating Percentage Based on Cell Color in Excel

Now, look at the following dataset. We have set colors for the cells that have a positive percentage change value and the cells with the word “Decreased” are ignored. (You can achieve this manually or by using Conditional Formatting). We want to calculate the percentage of rows that have this color criteria.

Dataset for Calculating Percentage Based on Cell Color Criteria in Excel

First, in cell C14, apply the following formula and press the Enter key to count total rows.

=COUNTA(E6:E12)

Using COUNT Function to Calculate Total Rows in Excel

Afterward, select any cell in the dataset => go to the Data tab and click on the Filter button => When the filter dropdown icons are visible, click on the dropdown icon of the column where you want to apply the color criteria filter.

Applying Filter Feature in Dataset

In the dropdown menu, click on the Filter by Color option and then select the desired cell color.

Filtering Rows Based on Colors

Now, only the rows that contain colored cells are visible. To calculate the count of only visible rows, we can apply the SUBTOTAL function. Apply the following formula in cell C15 and press the Enter key.

=SUBTOTAL(3,E6:E12)

Using SUBTOTAL Function to Count Rows While Ignoring Hidden Rows

Finally, apply the following formula in cell C16 and set the Number Format to percentage.

=C15/C14

Now, you will have your desired output.

Calculating Percentage Based on Cell Color Criteria


This concludes our article on how to calculate percentage with criteria in Excel. We discussed two useful examples: using the IF function to calculate the percentage with criteria and determining the percentage of rows based on cell color criteria in Excel. We hope this article will be helpful for you. Let us know your feedback in the comment section.


Calculate Percentage with Criteria in Excel: Knowledge Hub


<<Go Back to Calculating Percentages in Excel | How to Calculate in Excel | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Seemanto Saha
Seemanto Saha

Seemanto Saha graduated in Industrial and Production Engineering from Bangladesh University of Engineering and Technology. He has been with ExcelDemy for a year, where he wrote 40+ articles and reviewed 50+ articles. He has also worked on the ExcelDemy Forum and solved 50+ user problems. Currently, he is working as a team leader for ExcelDemy. His role is to guide his team to write reader-friendly content. His interests are Advanced Excel, Data Analysis, Charts & Dashboards, Power Query,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo