logo
search
Formula Errors

Calculate Percentage with COUNTIFS Formula in Spreadsheet

Maira MehtabMaira Mehtab Sep 20, 2026 869 views

Question details

The user needs to calculate the percentage of specific cases (e.g., "Clavicle #") within a specific time period (e.g., "June 2024") out of all cases recorded during that same time period.

Product
Spreadsheet
Device & OS
not provided
Scenario
Calculating the percentage of records meeting specific text criteria from a larger dataset by dividing a subset count by a conditional total count.
Observed behavior
The user requires the correct formula syntax to divide the number of matching subset cases by the total number of cases for a specific category, rather than dividing by non-matching cases.
Before you start

Ensure your dataset is organized into clear columns (e.g., Column B for Dates/Periods and Column C for Case Types) and verify that there are no hidden leading or trailing spaces in your text cells that might prevent exact matching.

Solution 1Recommended

Use COUNTIFS and COUNTIF to Calculate Conditional Percentage

Combine the COUNTIFS function to find the specific subset of cases and the COUNTIF function to find the total cases for the period, then divide them to get the percentage.

This formula relies on dividing the conditional subset by the conditional total. It uses wildcards (*) to match specific text within cells, making it highly flexible even if the cell contains additional text before or after your target keyword.

The numerator (COUNTIFS) checks for both the time period and the specific case type, while the denominator (COUNTIF) checks only for the time period.

1
Select the target cell

Click on the cell where you want the final percentage result to appear.

2
Enter the formula

Type the formula: =COUNTIFS(B:B,"*June 2024*",C:C,"*clavicle #*")/COUNTIF(B:B,"*June 2024*"). Adjust the column letters (B and C) to match the actual columns containing your date and case type data.

3
Calculate the result

Press the Enter key on your keyboard to apply the formula and calculate the decimal result.

4
Format as a percentage

Select the cell containing the result, navigate to the Home tab on the top ribbon, and click the '%' (Percentage Style) icon to format the decimal value as a percentage.

Wildcard Usage: The asterisks (*) placed around the text criteria act as wildcards. This allows the formula to successfully count cells that contain the specified text anywhere within the cell, regardless of other surrounding characters.
Work smarter with WPS Spreadsheet

Easily Analyze Data and Calculate Complex Formulas with WPS Office

WPS Spreadsheet offers comprehensive support for advanced statistical functions like COUNTIF and COUNTIFS, making it incredibly simple to analyze large datasets, set up conditional formatting, and calculate percentages effortlessly.

  1. 1. Download and Install: Download WPS Office for free from the official website and install it on your device.
  2. 2. Open your Spreadsheet: Launch WPS Spreadsheet and open your existing data file or create a new blank workbook.
  3. 3. Apply Formulas: Use the Formula tab or type directly into the formula bar to utilize advanced functions like COUNTIFS and instantly format your data.
Fully compatible with Microsoft Excel formulas, functions, and .xlsx file formats.Built-in function wizard to help you construct complex COUNTIFS formulas without syntax errors.Lightweight, fast, and free office suite available on Windows, Mac, Linux, and mobile devices.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my COUNTIFS formula returning a #DIV/0! error?

This error occurs when the denominator (the COUNTIF part of your formula) evaluates to zero. Check if the criteria in your COUNTIF formula exactly matches the data in your reference column, and ensure the column actually contains data that meets your condition.

Can I use cell references instead of typing text directly into the formula?

Yes. Instead of typing hard-coded text like "*June 2024*", you can use a cell reference concatenated with wildcards. For example, use "*"&A1&"*" where cell A1 contains the text you want to search for.

What is the primary difference between COUNTIF and COUNTIFS?

COUNTIF is used to count the number of cells that meet a single condition or criterion. COUNTIFS is used when you need to count cells that meet two or more criteria simultaneously across multiple different ranges.

Why is my formula returning 0 when I know the data exists?

This usually happens due to slight mismatches in data types or hidden characters. Ensure your target ranges are perfectly aligned (e.g., both referencing entire columns like B:B and C:C), and check for accidental typos in your criteria.