Ravindra BagaleCourses & study guides मराठी Track your progress

23. Formulas Across Sheets and Workbooks

23.8 Consolidate: Combine Sheets with Different Layouts

Example first. Three city sheets list category sales, but each city lists the categories in a different order and Nagpur has an extra category. A 3D SUM would add the wrong rows. Data › Consolidate matches by label and adds Dairy with Dairy, Fruits with Fruits.

Data › Consolidate — in 30 seconds

What: Consolidate combines ranges from several sheets (or files) with a function such as Sum, matching rows by the labels in the left column and columns by the labels in the top row.

Why: When sheets do not have the same layout, 3D references give wrong totals. Consolidate matches by name, so order and extra rows do not matter.

Tiny example: Dairy is row 2 in Pune, row 3 in Nashik and row 3 in Nagpur. Consolidate still adds them: 52,000 + 33,000 + 41,000 = ₹1,26,000.

First look at the data (before → after):

Data › Consolidate: before and after tables, fictional Blinkit Maharashtra data

Expected result — Consolidated result (sheet All Cities)

Category Sales (₹)
Dairy 1,26,000
Fruits 1,44,000
Snacks 67,000
Bakery 21,000
Home 54,000
Total 4,12,000
Before table and formula as text

Before — Sheet Pune (A1:B4)

A: Category B: Sales (₹)
Dairy 52,000
Fruits 61,000
Snacks 38,000

Before — Sheet Nashik (A1:B4)

A: Category B: Sales (₹)
Fruits 47,000
Dairy 33,000
Bakery 21,000

Before — Sheet Nagpur (A1:B5)

A: Category B: Sales (₹)
Snacks 29,000
Dairy 41,000
Fruits 36,000
Home 54,000

Formula / click path

Data › Data Tools › Consolidate › Function: Sum
References: Pune!$A$1:$B$4, Nashik!$A$1:$B$4, Nagpur!$A$1:$B$5 (Add each)
Use labels in: Top row + Left column › OK

Do it step by step:

  1. Make a new sheet named All Cities and click A1.
  2. Click Data › Data Tools › Consolidate.
  3. Choose Function: Sum.
  4. Click in Reference, go to the Pune sheet, select A1:B4 and click Add. Do the same for Nashik (A1:B4) and Nagpur (A1:B5).
  5. Tick Top row and Left column under Use labels in, then click OK.
  6. Check the total against the three sheet totals added together.

Options worth knowing

Option What it does
Function Sum, Count, Average, Max, Min and more
Use labels in: Left column Match rows by name (Dairy with Dairy). Without it, rows are matched by position
Use labels in: Top row Match columns by header
Create links to source data Builds an outline with formulas linked to each source, so the result updates when a source changes (works only when the sources are on other sheets)
References from other files Open the files, then select ranges in them while the Consolidate box is open

Consolidate vs the other ways

Method Best when
3D SUM (23.4) Every sheet has exactly the same layout
Consolidate Layouts differ, a one-off or monthly combine
Power Query Append (Module 10) The data is a list of records and arrives every month; refresh with one click
PivotTable on one Table You can keep all rows in one Table with a City column (the best design)

Practice task (try it before you open the answer):

  1. Build the three city sheets and consolidate them with Sum.
  2. Consolidate again into a new sheet with Function: Count.
  3. Add Bakery ₹15,000 to the Pune sheet (extend the reference to A1:B5) and consolidate once more.
Answer

Count: Dairy 3, Fruits 3, Snacks 2, Bakery 1, Home 1. After adding Pune Bakery ₹15,000 the Bakery total is ₹36,000 and the grand total ₹4,27,000.

Ravindra Bagale's Tip

Consolidate is a quick fix, not a system. If you consolidate the same sheets every month, spend one hour building Power Query once and get those hours back for the rest of the year.