Excellent! Thank you for the additional details. This makes the solution much more precise.
Since you're on a modern version of Excel and we can ignore the points, we can craft a very clean and powerful XLOOKUP formula that handles the new task format, "Task 1 (June 2)".
Updated Scenario & Table Structure
Let's confirm the setup with your new information.
1. Submissions Table (Sheet Name: SubmissionsData)
(Let's call this table SubmissionsTable)
| Participant Name | Task Entry | Completion Time |
|---|
| Alice | Task 1 (June 2) | 0:05:12 |
| Bob | Task 1 (June 2) | 0:06:30 |
| Alice | Task 2 (June 5) | 0:10:05 |
| Charlie | Task 1 (June 2) | 0:07:00 |
| Bob | Task 2 (June 5) | 0:09:15 |
| Alice | Task 3 (June 10) | 0:12:30 |
| ... | ... | ... |
2. Participants Table (Sheet Name: ParticipantsData)
(Let's call this table ParticipantsTable)
| Participant Name | Task 1 | Task 2 | Task 3 | ... | Task 11 |
|---|
| Alice | | | | | |
| Bob | | | | | |
| Charlie | | | | | |
| ... | | | | | |
The Solution: XLOOKUP with Text Manipulation
The goal is to match the Participant Name and the Task Header (e.g., "Task 1") from your Participants table with the Participant Name and the corresponding part of the Task Entry (e.g., "Task 1" from "Task 1 (June 2)") in your Submissions table.
Here is the formula you will place in cell B2 of your ParticipantsData sheet (the first cell for "Task 1").
=XLOOKUP(
$A2 & B$1,
SubmissionsTable[Participant Name] & TRIM(LEFT(SubmissionsTable[Task Entry], FIND("(", SubmissionsTable[Task Entry]) - 1)),
SubmissionsTable[Completion Time],
""
)
Let's Break Down the Formula:
-
$A2 & B$1: This is your lookup_value. It combines the participant's name from the current row (e.g., "Alice") with the task header from the current column (e.g., "Task 1"). The result is a unique lookup key like "AliceTask 1".
$A2: Locks the column to A, so when you drag the formula to the right, it always references the participant's name.
B$1: Locks the row to 1, so when you drag the formula down, it always references the header row.
-
SubmissionsTable[Participant Name] & TRIM(LEFT(SubmissionsTable[Task Entry], FIND("(", SubmissionsTable[Task Entry]) - 1)): This is your lookup_array. It creates a matching array of unique keys from the Submissions table.
SubmissionsTable[Participant Name]: This is the list of names from the submissions table.
LEFT(SubmissionsTable[Task Entry], ...): This function extracts text from the left side of the Task Entry string.
FIND("(", SubmissionsTable[Task Entry]) - 1: This finds the position of the opening parenthesis ( and subtracts 1. For "Task 1 (June 2)", it finds the ( at position 8, so it returns 7.
TRIM(...): This removes any accidental leading or trailing spaces. For "Task 1 ", it returns "Task 1".
- The whole expression effectively extracts "Task 1" from "Task 1 (June 2)", "Task 2" from "Task 2 (June 5)", and so on, then joins it with the participant's name to create a list like
{"AliceTask 1", "BobTask 1", "AliceTask 2", ...}.
-
SubmissionsTable[Completion Time]: This is the return_array. If XLOOKUP finds a match (e.g., "AliceTask 1"), it will return the corresponding value from this column.
-
"": This is the if_not_found argument. If a participant has not submitted a specific task, this will leave the cell blank instead of showing an #N/A! error.
A More Robust Version (Recommended)
The formula above works perfectly if every entry in Task Entry has a parenthesis. If some entries might be simple (e.g., just "Task 4"), the FIND function will produce an error. We can easily guard against this with IFERROR.
Use this formula for maximum reliability:
=XLOOKUP(
$A2 & B$1,
SubmissionsTable[Participant Name] & IFERROR(TRIM(LEFT(SubmissionsTable[Task Entry], FIND("(", SubmissionsTable[Task Entry]) - 1)), SubmissionsTable[Task Entry]),
SubmissionsTable[Completion Time],
""
)
What changed? The IFERROR function now wraps our text extraction.
IFERROR(..., SubmissionsTable[Task Entry]): It first tries to extract the text before the parenthesis. If that fails (because there is no (), it simply uses the entire cell value from Task Entry for the match. This makes your formula work in all cases.
How to Apply the Formula:
- Make sure your data ranges are converted to Excel Tables (
Ctrl + T) and named ParticipantsTable and SubmissionsTable.
- Click on cell B2 in your
ParticipantsData sheet (under the "Task 1" header).
- Copy and paste the recommended formula above into the formula bar.
- Press Enter.
- Click on cell
B2 again. You'll see a small square at the bottom-right corner (the "fill handle").
- Drag the fill handle to the right, across all your task columns (Task 2, Task 3, etc., up to Task 11). The formula will automatically adjust for each column.
- With all the task cells in the first row still selected, drag the fill handle down to the last participant.
Your Participants table will now automatically populate with the correct completion times from the Submissions table.