Count Text Values with Multiple Criteria in Excel
Question details
Count rows that match one of multiple text values in one range and an additional text criterion in another range.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet has text values in D4:D23 and options in E4:E23. The goal is to count rows where column D is A or B and column E is option4.
- Observed behavior
- The desired result is a single count of rows that meet both the A-or-B condition and the option4 condition.
Check that the two ranges cover the same rows and that the text values match those in your worksheet. Replace the example ranges and criteria in the formulas as needed.
Use COUNTIFS to Count Each Text Value
Use this formula to add the counts for A and B while applying the option4 condition to both.
Click an empty cell where you want the count to appear.
Type =COUNTIFS(D4:D23,"A",E4:E23,"option4")+COUNTIFS(D4:D23,"B",E4:E23,"option4") and press Enter.
Edit the ranges and quoted text in the formula bar to match your worksheet.

Use SUMPRODUCT for OR and AND Conditions
Use SUMPRODUCT to combine the A-or-B test with the option4 test in one formula.
Count Matching Text Rows in WPS Spreadsheets
Use COUNTIFS in WPS Spreadsheets to count rows that match either of two text values and an additional criterion.
- 1. Open the workbook: Open WPS Spreadsheets and select Open to load your workbook.
- 2. Select a cell: Click an empty cell where you want to display the count.
- 3. Enter COUNTIFS: Type =COUNTIFS(D4:D23,"A",E4:E23,"option4")+COUNTIFS(D4:D23,"B",E4:E23,"option4") and press Enter.
- 4. Adapt and save: Update the ranges and text criteria in the formula bar, then select Save.

Frequently Asked Questions
Why can't I put A and B in separate COUNTIFS criteria for the same range?
Separate criteria in COUNTIFS are combined with AND. A cell cannot equal both A and B, so add separate COUNTIFS results to apply an OR condition.
Can I add another text value to the count?
Yes. Add another COUNTIFS term, such as +COUNTIFS(D4:D23,"C",E4:E23,"option4"), to the formula.
Do the two criteria ranges need to be the same size?
Yes. Use equally sized ranges that cover corresponding rows, such as D4:D23 and E4:E23.
Does COUNTIFS distinguish uppercase and lowercase text?
No. COUNTIFS text comparisons are not case-sensitive, so the criterion "A" also matches "a".




