How to Mark an Excel Cell If a Value Falls Within a Date Range
Question details
The user wants to return a specific mark (like "x") in a cell if a row contains a specific status entry whose corresponding date falls between a defined start and end date.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking project statuses or analyzing data where specific conditions must be met within a designated timeframe.
- Observed behavior
- The user needs a formula to automatically evaluate conditions across rows and return a marker when both the date range and status criteria are met.
Ensure that the cells containing your dates are formatted as valid Excel dates rather than plain text, as formula evaluations depend on correct date serial numbers.
Use the IF and COUNTIFS Formula
Combine the IF and COUNTIFS functions to check if dates fall within the range and match your target status.
The COUNTIFS function allows you to count cells that meet multiple criteria, such as being greater than or equal to a start date, less than or equal to an end date, and containing a specific target value. By wrapping this in an IF statement, you can output a custom marker like 'x' if the count is greater than zero.
Note the row containing your dates (e.g., Row 3), the row with status values (e.g., Row 7), and the cells storing your start and end dates (e.g., AO6 for start, AO5 for end).
Select the target cell where you want the mark to appear and enter the formula: =IF(COUNTIFS(3:3,">="&AO$6,3:3,"<="&AO$5,7:7,"I")>0,"x","").
Press Enter to see the result. If you have multiple rows or columns, lock the references accordingly (using the $ symbol) and drag the fill handle to apply the formula to other cells.

Use WPS Spreadsheet to Analyze Date Ranges Easily
WPS Spreadsheet provides a comprehensive formula engine that perfectly supports advanced functions like COUNTIFS and IF. You can efficiently manage data ranges, analyze project timelines, and process complex conditional logic with a highly intuitive user interface.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook in the Spreadsheet module.
- 2. Enter the conditional formula: Click on your target cell and type your combined IF and COUNTIFS formula, utilizing the auto-complete feature to ensure correct syntax.
- 3. Format cells if needed: Right-click the date cells and select 'Format Cells' to quickly apply the correct Date format, ensuring your formulas evaluate perfectly.

Frequently Asked Questions
Why is my COUNTIFS date formula returning an empty cell instead of 'x'?
This usually happens if the dates in your dataset are formatted as text rather than valid date values. Select your date row, right-click, choose 'Format Cells', and apply a standard Date format.
Can I mark the cell with a different character or word?
Yes. In the formula =IF(COUNTIFS(...)>0,"x",""), simply change the "x" to your desired output, such as "True", "Yes", or "Matched".
How do I use hardcoded dates instead of cell references?
Instead of referencing a cell like AO$6, you can type the date directly in the formula using the DATE function or date text, for example: ">="&DATE(2023,1,1) or ">=1/1/2023".
What if I want to check columns instead of rows?
The COUNTIFS function works exactly the same way with columns. Simply replace the row references (like 3:3) with column references (like A:A or A2:A100).




