Calculate the Percentage of Cells Containing a Value in Excel
Question details
Calculate the percentage of response cells that contain a specific value, such as a.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A row contains product or customer responses, and the user wants to find the share marked with a particular value.
- Observed behavior
- The desired result is a percentage of matching responses, using either a fixed number of cells or the number of completed responses.
Identify the response range and the value you want to count. Decide whether the denominator should include all expected response cells or only nonempty cells.
Calculate the Percentage of Completed Responses
Use this formula when the number of completed responses can vary.
Select an empty cell and enter =IF(COUNTA(B2:K2)=0,"",COUNTIF(B2:K2,"a")/COUNTA(B2:K2)). Replace B2:K2 and a with your response range and target value.
With the result cell selected, go to Home and select Percent Style (%).
Drag the result cell's fill handle down to calculate the percentage for additional rows.

Calculate the Percentage Using a Fixed Response Count
Use a fixed denominator when every expected response cell should be included, even if some are blank.
Calculate Response Percentages in WPS Spreadsheets
Use COUNTIF and COUNTA in WPS Spreadsheets to calculate the share of completed responses matching a value, then format the result as a percentage.
- 1. Open your spreadsheet: Open WPS Spreadsheets and select Open to load your Excel workbook.
- 2. Enter the formula: Select an empty cell and enter =IF(COUNTA(B2:K2)=0,"",COUNTIF(B2:K2,"a")/COUNTA(B2:K2)). Adjust the range and target value as needed.
- 3. Format the result: Select the formula cell, then choose Percent Style (%) on the Home tab.
- 4. Fill down: Drag the cell's fill handle down to calculate percentages for other response rows.

Frequently Asked Questions
How do I count a different response, such as r?
Replace "a" with "r" in the COUNTIF formula, for example, =COUNTIF(B2:K2,"r")/COUNTA(B2:K2).
Why does my formula show a division error?
If COUNTA returns zero, dividing by it produces a #DIV/0! error. Use =IF(COUNTA(B2:K2)=0,"",COUNTIF(B2:K2,"a")/COUNTA(B2:K2)) to display a blank when the range is empty.
Does COUNTIF distinguish between uppercase and lowercase letters?
No. COUNTIF is not case-sensitive, so the criterion "a" counts both a and A.
How do I include blank cells in the percentage?
Divide by the fixed number of expected response cells instead of COUNTA. For four cells in B2:E2, use =COUNTIF(B2:E2,"a")/4.




