Function Problems

Count Text Values with Multiple Criteria in Excel

Elise WilliamsElise Williams Dec 2, 2026 869 views

Question details

Count rows that match one of multiple text values in one range and an additional text criterion in another range.

Count Text Values with Multiple Criteria in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Select a result cell

Click an empty cell where you want the count to appear.

2
Enter the formula

Type =COUNTIFS(D4:D23,"A",E4:E23,"option4")+COUNTIFS(D4:D23,"B",E4:E23,"option4") and press Enter.

3
Adjust the criteria

Edit the ranges and quoted text in the formula bar to match your worksheet.

Use COUNTIFS to Count Each Text Value
Shorter array formula: You can also use =SUM(COUNTIFS(D4:D23,{"A";"B"},E4:E23,"option4")). Formula separators may differ depending on your regional settings.
Count with WPS Spreadsheets

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. 1. Open the workbook: Open WPS Spreadsheets and select Open to load your workbook.
  2. 2. Select a cell: Click an empty cell where you want to display the count.
  3. 3. Enter COUNTIFS: Type =COUNTIFS(D4:D23,"A",E4:E23,"option4")+COUNTIFS(D4:D23,"B",E4:E23,"option4") and press Enter.
  4. 4. Adapt and save: Update the ranges and text criteria in the formula bar, then select Save.
Count multiple text criteria with familiar spreadsheet formulasOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with a free, lightweight office suite
microsoft office alternative - wps office

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".