Count Text When an Adjacent Cell Is Numeric in Excel
Question details
Count cells containing ABC only when the corresponding adjacent cell contains a numeric value.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Text values are in one column and the adjacent column contains values that must be tested for numbers.
- Observed behavior
- The desired count includes exact ABC matches only where the adjacent cell is numeric.
Identify the text range and adjacent value range, and make sure they cover the same rows. The examples below use A2:A10 for text and B2:B10 for adjacent values.
Use SUMPRODUCT to count text beside any number
Use this formula to include zero, positive numbers, and negative numbers while excluding blanks and text.
Click an empty cell where you want the count to appear.
Type =SUMPRODUCT((A2:A10="ABC")*ISNUMBER(B2:B10)) and press Enter.
In the formula bar, replace A2:A10 and B2:B10 with your own same-sized ranges, and replace ABC with the text you want to count.

Use COUNTIFS when only positive numbers qualify
Use this shorter formula if the adjacent value must be greater than zero.
Count text beside numeric values in WPS Spreadsheets
Use SUMPRODUCT and ISNUMBER in WPS Spreadsheets to count matching text only when the adjacent cell contains a number.
- 1. Open the spreadsheet: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Select a result cell: Click an empty cell where the count should appear.
- 3. Enter the formula: Type =SUMPRODUCT((A2:A10="ABC")*ISNUMBER(B2:B10)) and press Enter.
- 4. Adapt the formula: Use the formula bar to replace the sample ranges and ABC with your own ranges and text.

Frequently Asked Questions
Does the formula count zero and negative numbers?
Yes. ISNUMBER returns TRUE for zero, positive numbers, and negative numbers. Use the COUNTIFS criterion ">0" if only positive values should count.
Why isn't a number stored as text counted?
ISNUMBER treats a numeric-looking text value as text, not a number. Convert the value to a number before applying the formula if it should qualify.
Does the text match have to be exactly ABC?
Yes. The comparison A2:A10="ABC" matches the whole cell value, not text containing extra characters. It is not case-sensitive.
Will dates in the adjacent column be counted?
Yes. Excel stores dates as numeric values, so ISNUMBER returns TRUE for a valid stored date.




