Advanced / Lesson 08

Clean, merge & append

Combine files and reference data without silently multiplying your records.

~40 minutes4 exercisesSee lesson notes for version and platform support

By the end, you’ll be able to:

  • Choose append for adding records and merge for matching attributes
  • Use keys and join types deliberately
  • Check row counts, unmatched records and totals after transformations

Append stacks; merge matches

January has three orders and February has two orders with the same fields. Append adds their records into a longer table. It matches columns by name, so check spelling and data types rather than relying on column position. A field absent from one input produces null values for those records.

A product master has one row per SKU and a Category field. Merge matches each order's SKU to that master so Category can be added to the order. It combines information by a key rather than simply adding more order rows.

Neither operation verifies that the business meaning is correct. Keep each table's grain explicit: one row per order line, product or monthly total.

Worked example: combine two months

Create two Excel tables with headings Order, SKU and Sales. January contains O101/P101/100, O102/P102/50 and O103/P103/80. February contains O104/P101/40 and O105/P102/70.

  1. Import both tables as queries and inspect their data types.
  2. In Power Query Editor choose Home → Append Queries → Append Queries as New.
  3. Select the January and February queries and name the result AllOrders.
  4. Confirm 5 records and 340 Sales.
  5. Keep the month or source-file field if the report must trace provenance.

If monthly files contain overlapping order lines, append retains those duplicates. Do not remove them until a valid unique key and duplicate rule have been established.

Add category with a left outer merge

  1. Create a Products table with SKU/Category: P101/Accessories, P102/Travel and P103/Office.
  2. Import it as a query and confirm that SKU is unique and Text.
  3. Select AllOrders and choose Home → Merge Queries.
  4. Select SKU in both tables, in the same order if a composite key uses several columns.
  5. Choose Left Outer to retain every AllOrders record.
  6. Expand only Category from the nested match column.
  7. Confirm 5 rows and total Sales still 340.

An Inner join keeps only matches. A Left Outer join keeps the left records and uses null for unmatched attributes after expansion. A Left Anti join can create an exception list of orders without a product match. Choose the rule deliberately rather than hiding missing categories.

Detect one-to-many expansion

Suppose January's product master accidentally has two P101 rows. O101 then matches twice. Expanding both matches turns the original three January records into four rows and increases repeated Sales from 230 to 330.

The product attributes may look reasonable, yet any later sum is overstated. Before merging, group the master by SKU and count rows to find duplicate keys. After merging, compare record counts and total Sales with the pre-merge baseline.

When duplicate keys represent valid history or several suppliers, removing duplicates arbitrarily loses meaning. Add the necessary date, version or supplier condition, or aggregate to the intended grain before matching.

Make a refreshable cleanup sequence

A useful sequence is: keep required fields, standardize text keys, set types, check exceptions, append compatible records, merge validated attributes, then group or summarize at the report grain. Step order matters: a numeric conversion that already removed leading zeros cannot be repaired by trimming text afterward.

For a summary, Home → Group By can group AllOrders by Category and sum Sales. Accessories is 140, Travel 120 and Office 80; these reconcile to 340. Save the detailed prepared query too, so a reader can investigate the summary.

These are native Power Query activities. The browser questions check the combination logic and reconciliation; query authoring, joins and refresh are not simulated here. Platform capabilities follow the previous lesson's compatibility notes.

Now make it yours

Give it a try.

Work through each exercise, check your answer and use a hint whenever you need one. Formula tasks check changed inputs, including boundary cases.

0 of 4 exercises complete

Exercise 01 / Knowledge check

Choose how to combine monthly exports

January and February contain different order rows with the same column headings. Which operation adds them into one order list?

Choose one answer
Exercise 02 / Knowledge check

Reconcile appended sales

January Sales are 100, 50 and 80; February Sales are 40 and 70. After a correct append, enter total Sales.

Example worksheet with column letters and row numbers
ABCD
1MonthSales 1Sales 2Sales 3
2Jan1005080
3Feb4070
Exercise 03 / Knowledge check

Detect a duplicated master key

Three order rows have SKUs P101, P102 and P103. Products has two P101 matches and one match for each other SKU. After a left merge and expansion of all matches, how many rows result?

Exercise 04 / Knowledge check

Keep unmatched orders visible

You need every order retained, even if its SKU is absent from Products. Which merge join is appropriate when Orders is the left table?

Choose one answer

Take this with you

Append adds records; merge matches attributes. A successful operation still needs grain, key, row-count and total checks.

Practice in Excel

Download the course workbook, follow the tasks, save your completed .xlsx and check its supported formula tasks here. Native Excel features use a separate review checklist.

Download practice workbook Check my workbook ↗
Technical references and lesson review

Original lesson content. Technical behavior checked against Microsoft documentation. Reviewed 2026-10-16.

Find your next skill