How to Extract Task Start and End Days from X Marks in Excel
Question details
The user needs a method to determine the first and last occurrence of an 'X' in a schedule row to retrieve task start and end days.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Managing a project schedule where active task durations are visually represented by 'X' marks across date columns, and numeric start and end dates need to be automatically extracted.
- Observed behavior
- The active task days are marked with an 'X', but there is no direct date output without using lookup formulas to search for the first and last 'X' marks in the row.
Ensure your schedule has a header row containing the actual days or dates. Verify that your spreadsheet software supports the XLOOKUP function if you plan to use the recommended method.
Use XLOOKUP to Find First and Last Occurrences
The most efficient way to extract the start and end dates is by utilizing the search mode parameter in the XLOOKUP function.
XLOOKUP allows you to search a range from first-to-last or last-to-first. By changing the search mode argument to 1 (first-to-last) or -1 (last-to-first), you can accurately extract the start and end columns.
Select the cell for the Start Day (e.g., B5) and enter the formula: =XLOOKUP("X",D5:AQ5,D$3:AQ$3,,,1) to return the first matching day.
Select the cell for the End Day (e.g., C5) and enter the formula: =XLOOKUP("X",D5:AQ5,D$3:AQ$3,,,-1) to return the last matching day.
Highlight both cells (B5 and C5), grab the fill handle in the bottom right corner, and drag it down to apply the formulas to the remaining task rows.

Use INDEX and MIN/MAX Array Formulas
For older spreadsheet versions that lack XLOOKUP, you can use an array formula combining INDEX, MIN/MAX, and COLUMN functions.
Automate Complex Task Schedules with WPS Spreadsheet
WPS Office Spreadsheet fully supports modern functions like XLOOKUP and dynamic arrays, making it incredibly easy to manage advanced project schedules and automate date extractions.
- 1. Open Your Project Tracker: Launch WPS Spreadsheet and open your existing project schedule file.
- 2. Input XLOOKUP for Start Date: Click the designated Start Day cell and enter the first-to-last XLOOKUP formula.
- 3. Input XLOOKUP for End Date: Click the designated End Day cell and apply the last-to-first XLOOKUP formula.
- 4. Apply Logic Instantly: Select the formulated cells and drag the fill handle down to extract dates for all project tasks immediately.

Frequently Asked Questions
Why does my XLOOKUP formula return an #N/A error?
If a specific task row contains no 'X' marks at all, XLOOKUP cannot find a match and returns #N/A. You can prevent this error by defining a fallback value in the 'if_not_found' argument, for example: =XLOOKUP("X",D5:AQ5,D$3:AQ$3,"No Task",,1).
Is the XLOOKUP function case-sensitive when searching for 'X'?
By default, XLOOKUP is not case-sensitive. It will successfully match both uppercase 'X' and lowercase 'x' marks in your schedule unless you force a case-sensitive search using the EXACT function.
What if my return array and lookup array are different sizes?
XLOOKUP requires the lookup array (the cells with 'X' marks) and the return array (the header row with dates) to be exactly the same size. Ensure both ranges span identical columns (e.g., D5:AQ5 and D$3:AQ$3) to avoid calculation errors.




