Use Excel COUNTIFS to Count Matching Rows Across Worksheets
Question details
Count rows on one worksheet where an identifier matches a cell on another worksheet and a second column contains text.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The formula is entered in Type1Dem!D4 and checks Type1List column B against Type1Dem!B4 and column G for text.
- Observed behavior
- The desired result is a count of Type1List rows that meet both criteria on the same row.
Check that the worksheet names are Type1List and Type1Dem, and that the identifier to match is in Type1Dem!B4. Confirm that Type1List columns B and G contain the identifiers and text to be checked.
Count matching rows that contain text with COUNTIFS
Use this formula when column G must contain at least one text character.
COUNTIFS evaluates the criteria on the same row. The wildcard criterion "?*" matches text containing at least one character; it does not count numeric values in column G.
Open the Type1Dem worksheet and select cell D4.
Enter =COUNTIFS(Type1List!B:B,Type1Dem!B4,Type1List!G:G,"?*") in D4 and press Enter.
Compare the count with rows on Type1List where column B matches Type1Dem!B4 and column G contains text.

Count matching rows with nonblank cells in column G
Use this option if column G can contain numbers or other nonblank values, not just text.
Count matching worksheet rows in WPS Spreadsheets
Use COUNTIFS in WPS Spreadsheets to match an identifier across worksheets and count rows containing text.
- 1. Open the workbook: Open WPS Spreadsheets, select Open, and choose the workbook containing Type1List and Type1Dem.
- 2. Select the result cell: Click the Type1Dem worksheet tab and select D4.
- 3. Enter COUNTIFS: Type =COUNTIFS(Type1List!B:B,Type1Dem!B4,Type1List!G:G,"?*") and press Enter.
- 4. Save the workbook: Select Save to keep the formula in the workbook.

Frequently Asked Questions
What is the difference between "?*" and "<>" in COUNTIFS?
The criterion "?*" matches text with at least one character. The criterion "<>" checks for nonblank values, including numbers.
Can I copy the formula down for other identifiers?
Yes. Enter the formula in Type1Dem!D4 and drag its fill handle down. The B4 reference changes to B5, B6, and so on.
How do I reference a worksheet name that contains spaces?
Put single quotation marks around the sheet name, as in 'Type 1 List'!B:B. Use the exact worksheet name in each range reference.
Why might COUNTIFS return an unexpected count?
Check that the identifier in Type1Dem!B4 matches the values in Type1List column B and that column G contains the type of value your criterion is intended to count. Also check for spaces in the source data.




