Formula Errors

How to Count Matching Words Before or After a Date in Excel

Camila MilosovichCamila Milosovich Nov 11, 2026 869 views

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.

How to Count Matching Words Before or After a Date in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the destination cell

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

2
Enter the SUMPRODUCT formula

Type the formula: `=SUMPRODUCT((A2:A10<>"")*(A2:A10<I1)*(ISNUMBER(SEARCH("Hinz",B2:G10))+ISNUMBER(SEARCH("Natz",B2:G10))))` into the formula bar.

3
Adjust ranges and criteria

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.

4
Calculate the result

Press the Enter key. The cell will now display the total count of matching words that occur before the target date.

Use SUMPRODUCT to Count Words Before a Specific Date
Excluding blank cells: The segment `(A2:A10<>"")` ensures that blank cells in your date column are not incorrectly evaluated as dates before your target date.
Advanced Formula Editor

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. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the dates and text data.
  2. 2. Select a cell for your result: Click on the cell where you want to display the final word count.
  3. 3. Input the formula: Paste your customized SUMPRODUCT formula into the formula bar at the top.
  4. 4. Calculate instantly: Press Enter to execute the array formula and instantly view the precise matching count.
Fully compatible with Microsoft Excel formulas and the .xlsx formatRobust support for advanced array calculations like SUMPRODUCTIntuitive formula builder with built-in error checkingFree and lightweight alternative for daily data analysis
microsoft office alternative - wps office

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.