How to Count Matching Words Before or After a Date in Excel
Question details
The user needs to count specific words within a cell range, but only if the corresponding date in another column falls before or after a given target date.

- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Filtering and counting specific text entries based on a date threshold, such as tracking appointments or events before a deadline.
- Observed behavior
- The user needs a combined formula to handle both text searching across multiple columns and conditional date comparisons simultaneously.
Ensure your date column is formatted properly as dates, rather than text, and that the target appointment date you are comparing against is placed in a dedicated reference cell (e.g., I1) to easily update your criteria.
Use SUMPRODUCT to Count Words Before a Specific Date
Combine SUMPRODUCT with ISNUMBER and SEARCH to filter out blank dates, apply a 'before' date criteria, and count cells containing target words.
The SUMPRODUCT function evaluates multiple arrays and conditions simultaneously. By checking if a date is less than the reference date and using the SEARCH function to find specific strings, you can accurately count matching occurrences.
Click on an empty cell where you want the final count result to appear.
Type the formula: `=SUMPRODUCT((A2:A10<>"")*(A2:A10<I1)*(ISNUMBER(SEARCH("Hinz",B2:G10))+ISNUMBER(SEARCH("Natz",B2:G10))))` into the formula bar.
Replace 'A2:A10' with your actual date column, 'I1' with the cell containing your target appointment date, 'B2:G10' with your text range, and the text strings (like "Hinz" and "Natz") with your actual target words.
Press the Enter key. The cell will now display the total count of matching words that occur before the target date.

Modify the Formula to Count Words After a Specific Date
Adjust the comparison operator in your SUMPRODUCT formula to count entries that occur after the target appointment date.
Effortlessly Manage Complex Array Formulas in WPS Spreadsheet
WPS Spreadsheet fully supports advanced array calculations and nested functions like SUMPRODUCT and SEARCH. You can easily apply sophisticated date and text filtering conditions to your datasets with fast processing speeds.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the dates and text data.
- 2. Select a cell for your result: Click on the cell where you want to display the final word count.
- 3. Input the formula: Paste your customized SUMPRODUCT formula into the formula bar at the top.
- 4. Calculate instantly: Press Enter to execute the array formula and instantly view the precise matching count.

Frequently Asked Questions
Can I make the word matching case-sensitive?
Yes. The SEARCH function is not case-sensitive. If you need case-sensitive matching (e.g., differentiating between 'Apple' and 'apple'), replace the SEARCH function with the FIND function in your SUMPRODUCT formula.
Why is my SUMPRODUCT formula returning a #VALUE! error?
This usually happens when the array ranges in your formula are not the same size. Ensure that the row numbers match exactly. For instance, if your date range is A2:A10, your text search range must also span rows 2 to 10 (e.g., B2:G10).
How do I count entries that happen exactly on the appointment date?
You can modify the comparison operator in the date segment of the formula. Change the less-than operator (`<`) to an equals sign (`=`). The segment should look like `(A2:A10=I1)` to count entries exactly on that specific date.
Is there a German Excel equivalent for these functions?
Yes. If you are using a German localized version of Excel, SUMPRODUCT translates to SUMMENPRODUKT, ISNUMBER is ISTZAHL, and SEARCH is SUCHEN. Also, remember to use semicolons (;) instead of commas (,) to separate formula arguments.




