Function Problems

How to Extract Task Start and End Days from X Marks in Excel

Elise WilliamsElise Williams Nov 11, 2026 868 views

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.

Extract Task Start and End Days from X Marks
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter Start Day Formula

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.

2
Enter End Day Formula

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.

3
Fill the Formulas Down

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 XLOOKUP to Find First and Last Occurrences
Absolute References: Make sure the header row reference (D$3:AQ$3) uses a dollar sign ($) for the row number so it remains fixed when you fill the formulas down.

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. 1. Open Your Project Tracker: Launch WPS Spreadsheet and open your existing project schedule file.
  2. 2. Input XLOOKUP for Start Date: Click the designated Start Day cell and enter the first-to-last XLOOKUP formula.
  3. 3. Input XLOOKUP for End Date: Click the designated End Day cell and apply the last-to-first XLOOKUP formula.
  4. 4. Apply Logic Instantly: Select the formulated cells and drag the fill handle down to extract dates for all project tasks immediately.
100% format and formula compatibility with Microsoft ExcelNatively supports XLOOKUP and advanced array functionsFree, lightweight, and user-friendly interface for effortless project management
microsoft office alternative - wps office

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.