To create a one-to-many relationship in Excel, use a lookup formula such as XLOOKUP, INDEX/MATCH, or a PivotTable to pull multiple matching records from a source table into a summary sheet. Excel does not have a built-in relational data model like a database, so you simulate one-to-many by keeping a unique list of parent records and using formulas or Power Query to return all child records that match each parent. The most reliable method for most users is Power Query: load both tables, merge them on the shared key, and expand the child column. For quick, formula-based results, XLOOKUP with a dynamic array or a helper column with COUNTIF works well. This guide walks through both approaches, plus the mistakes that cause #N/A errors and the fixes for them.

What You'll Need

  • Excel 365, Excel 2021, or Excel 2019 (XLOOKUP requires 365 or 2021; Power Query is built into 2016 and later).
  • Two tables: a parent table with unique IDs (e.g., CustomerID, OrderID) and a child table with multiple rows per ID.
  • Both tables formatted as Excel Tables (select data, press Ctrl+T) so ranges expand automatically.
  • A shared key column with exactly matching values in both tables (same data type, no leading/trailing spaces).

Step-by-Step

  1. Clean and standardise the key column. In both tables, select the key column and use Data > Text to Columns or TRIM to remove spaces. Ensure both columns are formatted as Text or both as Number. A mismatch here is the most common cause of failed matches.
  2. Convert both ranges to Tables. Click any cell in the parent data, press Ctrl+T, confirm the range, and tick "My table has headers." Name the table on the Table Design tab (e.g., tblParents). Repeat for the child table (e.g., tblChildren).
  3. Build a unique parent list. On a new sheet, paste the parent IDs, then use Data > Remove Duplicates to keep one row per parent. Or use =UNIQUE(tblParents[ID]) in Excel 365 to generate a dynamic list.
  4. Choose your method. For a single matching value per parent, use XLOOKUP: =XLOOKUP([@ID], tblChildren[ID], tblChildren[Value], "Not found"). For multiple matches, continue with Power Query below.
  5. Open Power Query. Select the child table, then Data > From Table/Range. The Power Query Editor opens. Repeat for the parent table using Data > From Table/Range on a new query.
  6. Group the child rows. In the child query, select the key column, then Transform > Group By. Group by the key and create a new column using operation "All Rows." This produces one row per parent with a nested table of child records.
  7. Merge the queries. Go to Home > Merge Queries. Select the parent query as the primary table and the grouped child query as the secondary, matching on the key column. Choose Left Outer join so every parent appears even if it has no children.
  8. Expand the child column. Click the expand icon (two arrows) on the new column and select the child fields you want to display. Untick "Use original column name as prefix" if you prefer clean headers.
  9. Load to a worksheet. Click Close & Load To, choose Table, and pick a location. The result is a flat table where each parent row repeats for every child record, which is the one-to-many output.
  10. Verify counts. Add a COUNTIF column next to your parent list: =COUNTIF(tblChildren[ID],[@ID]). Compare it with the number of rows returned by the merge. If they differ, a key mismatch exists.

Common Mistakes

  • Mismatched data types. Numbers stored as text (or vice versa) will not match. Use the ISTEXT or ISNUMBER functions to check, and convert with VALUE or TEXT as needed.
  • Hidden spaces. Trailing spaces in imported data break lookups. Apply TRIM to both key columns before merging.
  • Duplicate keys in the parent table. A one-to-many model requires unique parent IDs. Remove duplicates first or the merge will multiply rows unexpectedly.
  • Using VLOOKUP for multiple matches. VLOOKUP returns only the first match. It cannot return a list of child records without helper columns or array formulas.
  • Forgetting to refresh. Power Query results are static until you click Data > Refresh All. Formulas update automatically; query output does not.

Tips

  • Use XLOOKUP's if_not_found argument to display a clean message instead of #N/A.
  • For a comma-separated list of all child values per parent, use TEXTJOIN with an array formula in Excel 365: =TEXTJOIN(", ", TRUE, FILTER(tblChildren[Value], tblChildren[ID]=[@ID])).
  • Name your tables meaningfully; Power Query steps reference these names and are easier to audit.
  • Keep a backup of the raw data before merging; Power Query changes are reversible but manual edits are not.
  • If you need to report on the one-to-many data, load the merged result to the Data Model and build a PivotTable from it.

Troubleshooting

  • #N/A in XLOOKUP. Check for spaces, case differences (XLOOKUP is case-insensitive by default), and data type mismatches. Use =EXACT(A2,B2) to test for hidden character differences.
  • Merge returns fewer rows than expected. The join type may be Inner instead of Left Outer. Re-open the merge step and confirm the join kind.
  • Duplicate rows after merge. The parent table likely contains duplicate IDs. Remove duplicates and refresh.
  • Power Query error "DataFormat.Error." A column contains mixed types. Set the column type explicitly in Power Query (Transform > Data Type) before grouping.
  • Formulas not updating. Check Calculation Options is set to Automatic (Formulas > Calculation Options).

Frequently Asked Questions

Can Excel handle true one-to-many relationships?

Not natively like a database. You simulate it with lookups, Power Query merges, or the Data Model. Power Pivot can create relationships between tables, but displaying multiple child rows per parent still requires a flattening step.

What is the difference between XLOOKUP and Power Query for this?

XLOOKUP returns a single value per lookup. Power Query can return and expand all matching rows, making it the better choice for a full one-to-many listing.

Why does my VLOOKUP only return the first match?

VLOOKUP stops at the first match by design. To get all matches, use FILTER (Excel 365) or Power Query.

Can I do this on Excel for Mac?

Yes. Power Query is available in Excel for Microsoft 365 for Mac, though some older Mac versions lack it. XLOOKUP is available in 365 and 2021 for Mac.

How do I refresh the merged data?

Click Data > Refresh All. If the source tables are on another sheet, ensure they are still in the same workbook or update the query source path.

Does this work with Excel Online?

Excel Online supports XLOOKUP and basic formulas but has limited Power Query editing. For full merge functionality, use the desktop app.