How to Use COUNTIFS for Numeric Ages and Text Values in Spreadsheets
Question details
The user needs to count specific records in a dataset where age values are mixed between numeric entries and specific text strings.

- Product
- Spreadsheets
- Device & OS
- not provided
- Scenario
- Counting adult readers from a dataset containing both numeric ages (e.g., 19 and older) and text representations (e.g., '21+'), along with optional secondary criteria like logged reading activity.
- Observed behavior
- The user needs a formula that accurately calculates a combined count using OR logic across mixed data types, as standard COUNTIFS defaults to AND logic.
Ensure that your data range does not contain leading or trailing spaces, as hidden spaces can prevent the COUNTIFS function from correctly recognizing text values.
Combine Multiple COUNTIFS Functions with Addition
Use the addition operator (+) to combine two separate COUNTIFS functions. This creates an OR logic scenario allowing you to count both numbers and exact text matches simultaneously.
The standard COUNTIFS function checks if multiple conditions are met simultaneously (AND logic). To count cells that meet one condition OR another—like being a number greater than or equal to 19 OR being the text string '21+'—you must calculate the counts separately and add them together.
This method is highly scalable. If you need to filter the count further, such as only counting users who logged reading activity, you can append the additional criteria to both sides of the formula.
Click on the blank cell where you want the final calculated total to appear.
Type `=COUNTIFS(AVID!$A$2:$A$500, ">=19")` to count all numeric age values that are 19 or older in your data range.
Immediately after the first formula, type `+COUNTIFS(AVID!$A$2:$A$500, "21+")` to append the count of text values exactly matching '21+'.
If you need to count based on logged activity, add the activity range and condition to both functions. For example: `=COUNTIFS(AVID!$A$2:$A$500, ">=19", AVID!$B$2:$B$500, ">0") + COUNTIFS(AVID!$A$2:$A$500, "21+", AVID!$B$2:$B$500, ">0")`.
Press the Enter key to calculate and display the total combined count.

Master Complex Formulas with WPS Spreadsheet
WPS Spreadsheet provides a robust and intuitive environment for handling advanced data analysis tasks, including complex logical functions like COUNTIFS. It fully supports standard spreadsheet formulas, making it easy to calculate mixed data types seamlessly.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the mixed age data.
- 2. Select the output cell: Click the cell where you want to calculate the combined formula count.
- 3. Input the combined COUNTIFS formula: Type the formula combining your conditions, for example: `=COUNTIFS(A2:A500,">=19") + COUNTIFS(A2:A500,"21+")`.
- 4. Execute the calculation: Press Enter to instantly see the precise count of mixed numeric and text data.

Frequently Asked Questions
Why is my COUNTIFS formula returning 0 for text values?
This typically occurs if the text in the referenced cell contains hidden spaces (e.g., ' 21+ ' instead of '21+'). You can use the TRIM function on your data range or use Find and Replace to remove excess spaces before applying the COUNTIFS formula.
Can I use an array formula instead of adding two COUNTIFS functions together?
Yes. If your spreadsheet version supports dynamic arrays, you can use a formula like `=SUM(COUNTIFS(AVID!$A$2:$A$500, {">=19", "21+"}))`. This computes both counts simultaneously and wraps them in a SUM function to deliver a single total.
How do I add a date range condition to this formula?
You must append the date criteria range and the date condition to both parts of the formula. For example, add `, DateRange, ">=1/1/2023"` inside the parentheses of both the first and the second COUNTIFS statements.
Is COUNTIFS case-sensitive when evaluating text strings?
No, the COUNTIFS function is not case-sensitive. It will evaluate 'text', 'TEXT', and 'Text' as identical values when processing criteria.




