23. Formulas Across Sheets and Workbooks
23.8 Consolidate: Combine Sheets with Different Layouts
Combine category totals even when the rows appear in a different order
A fictional regional shop receives one sales worksheet for each city. Pune lists Dairy first. Nashik starts with Fruits. Nagpur begins with Snacks and has another category called Home. The owner wants one regional sales amount per category. Adding row 2 across every tab would combine different products. Excel’s Consolidate command can match category labels and sum the corresponding numeric cells, even when the labels appear on different rows of the selected sources.
Consolidation is an aggregation: read several approved inputs and produce a smaller set of summary measures. One result might be total Dairy sales across the three cities. An appended dataset has a different purpose. It keeps one row for each source record before a later grouping or report. The original three worksheets already hold category subtotals, so a consolidated five-category report can answer this question without reconstructing every purchase behind those subtotals. Check what a source row represents before choosing the output.
- Match the category. Look for Dairy in each source. Its row number is allowed to change.
- Keep the input scope explicit. A newly added category counts only if its row belongs to a selected source range.
- Audit individual groups and totals. Both the right and wrong grouping can add up to ₹412000 on this teaching fixture.
Read the data contract before the ribbon steps
Each source worksheet in the practice workbook has columns Category and Sales. Each numbered source row represents one approved city subtotal for that category over an identical period. Sales are reported in whole rupees. Source totals belong outside the input rectangles. A label such as Dairy needs the same category definition in every city. If one city includes plant-based products and another excludes them, sharing a label and a number format would not resolve the difference. Align the definitions before combining.
Create a new workbook with Pune, Nashik, Nagpur and All Cities. On each city tab place Category in A1 and Sales in B1. Enter the following rows at their actual coordinates. The amounts are synthetic. Leave the next rows empty for the later scope test. The source data has three approved records for Pune, three for Nashik and four for Nagpur. Keep All Cities clear for the result.
| Worksheet | Row | Category in A | Sales in B |
|---|---|---|---|
| Pune | 2 | Dairy | 52000 |
| Pune | 3 | Fruits | 61000 |
| Pune | 4 | Snacks | 38000 |
| Nashik | 2 | Fruits | 47000 |
| Nashik | 3 | Dairy | 33000 |
| Nashik | 4 | Bakery | 21000 |
| Nagpur | 2 | Snacks | 29000 |
| Nagpur | 3 | Dairy | 41000 |
| Nagpur | 4 | Fruits | 36000 |
| Nagpur | 5 | Home | 54000 |
Keep the row labels and column headers intact when preparing inputs. Do not insert an empty separator within a source list, a banner within the selected range or a source subtotal under the same measure field. Keep a distinctive test amount so you can trace one row to the output later. Check the actual numeric cells by selecting them and reviewing the formula bar. A text value that resembles ₹52000 cannot be treated as an approved measurement without validating the conversion.
Create a label-based consolidation
The example uses desktop Excel with Data Consolidate available. Microsoft notes that some versions and platforms, including Excel for the web, may not expose this feature. Check your ribbon and use the desktop steps below where supported. The manual formula check shown later can reproduce the fixed fixture in a compatible worksheet editor. A supported query can be a good fit when the inputs need recurring preparation. Keep the case goal clear whichever method you use: an amount per approved category.
- On All Cities choose an upper-left destination cell with room for headings and result rows, such as A1. Keep duplicate test results on separate blank sheets.
- Open Data and look for Consolidate in its data tools. Set Function to Sum.
- Use Reference to select Pune A1:B4 and select Add. Repeat for Nashik A1:B4 and Nagpur A1:B5. Check that All references shows each source once.
- Under Use labels in, select Top row and Left column. Top row identifies Sales as the measure heading, and Left column identifies the category keys.
- Leave Create links to source data unchecked for the first snapshot. Confirm the settings and inspect the generated result.
Use full labeled ranges in the category case. The command needs to read the heading and the values next to each group, rather than just the numbers. The headers show the same unit and measure across the three sources. Labels in the left column tell Excel the names by which to line up the amounts. The exact generated row order can depend on your inputs and client. Match by the resulting names during verification. The expected values below include your separate hand-added control total.
| Category | Sum in rupees | Numeric source rows | Contributing values |
|---|---|---|---|
| Dairy | 126000 | 3 | 52000 + 33000 + 41000 |
| Fruits | 144000 | 3 | 61000 + 47000 + 36000 |
| Snacks | 67000 | 2 | 38000 + 29000 |
| Bakery | 21000 | 1 | 21000 |
| Home | 54000 | 1 | 54000 |
| All categories | 412000 | 10 | Total of the approved city subtotals |
Verify the purpose of the aggregation
Dairy appears in all three lists, so its amounts are 52000, 33000 and 41000. The total of ₹126000 covers three contributing city-category records. Home appears only in Nagpur. It still belongs in the approved category result and contributes ₹54000. The command does not invent missing city records. A city that never carried Home, a report that excludes it and an extract that failed to collect it can all leave Home absent from that source. Use source approval and reporting context to interpret the absence.
Check totals by source as well as by output label. Pune contributes ₹151000, Nashik contributes ₹101000, and Nagpur contributes ₹160000. Summing those independently gives ₹412000. The five output values should also total ₹412000. The city check detects arithmetic or missing records that affect the sum. The category check proves that the amount was assigned correctly. Run both checks, because reassigning amounts between categories can preserve the grand total.
Compare category matching with a positional total
3-D formulas and position-based consolidation can be useful when the source worksheets follow the same layout by design. Apply that rule only after you know each position has a common meaning. In these sheets, row 2 contains Dairy, Fruits and Snacks. Adding its B2 values yields ₹128000, a correct sum of the cells and an inappropriate answer for Dairy. Row 3 similarly yields ₹135000, and row 4 yields ₹95000. Nagpur alone has row 5 at ₹54000. Adding these four positional results also gives ₹412000.
On a test sheet, place the one-line positional checks in spare cells. Pick all three inputs in each formula and write their labels in a nearby note. When explaining the result, translate the references into records. “Pune Dairy plus Nashik Fruits plus Nagpur Snacks” makes the wrong grouping obvious. “B2 from all three tabs” makes it easier to miss. This translation is a useful review when someone inherits an older worksheet with correct-looking figures and unclear field definitions.
=SUM(Pune!B2,Nashik!B2,Nagpur!B2)
=SUM(Pune!B3,Nashik!B3,Nagpur!B3)
=SUM(Pune!B4,Nashik!B4,Nagpur!B4)
=SUM(Nagpur!B5)
A position-based workbook can still work using prepared sources with the same ordered category rows on all three sheets. That requires more than sorting independently. Each city must include the same category roster in the same row order, including a documented treatment for missing records. A sorted list with one missing label can shift all later positions. Rebuilding a controlled template may make sense when recurring worksheets are small. If the reporting goal depends on labels that naturally vary across contributors, use an explicit category match and validate the allowed labels.
Follow the Dairy group across three differently ordered sheets
Find the first Dairy record
Pune A2 says Dairy and B2 gives ₹52000. Record the label alongside the number.
Find Dairy by name on two more sheets
Use Nashik B3 and Nagpur B3. They contribute ₹33000 and ₹41000.
Calculate the group result
The three approved inputs sum to ₹126000. This is a different grouping from adding the three values in row 2.
Compare it with two controls
Verify three numeric Dairy source records and check that all five reported category totals still add to ₹412000.
Set the measure and the range behavior explicitly
Compare sum, count, average and maximum
Sum answers how much money came from all contributing records. Running Consolidate on another empty sheet with the Count option gives the original exercise’s counts when every approved measurement is numeric. Count Numbers, where offered, restricts the operation to numeric values. A Dairy count of three is the number of contributing summarized records in our fixture. Since each comes from a different city, it also equals the city count for that category here. If one city includes two source rows for a category, the record count and city count can differ. Neither means transactions or individual units sold.
Average answers how much one available contributing record supplies on average. For Snacks, the two measured input values give an average of ₹33500. If Nashik contains a confirmed measured zero in a separately approved source row and that row is explicitly included, the sum remains ₹67000, the numeric count becomes three, and the mean becomes about ₹22333.33. If Nashik has no approved measurement, treating its absence as zero would silently change the denominator. Measure and count expectations should state whose observations were actually present.
Maximum answers which contributing amount is largest. For Dairy the result is ₹52000 from Pune. The amount can be inspected alongside the source category records if someone needs the city name. A consolidated maximum itself supplies a value. Summing category maxima would answer a different question from summing all the source values. For this dataset the five separate maxima are 52000, 61000, 38000, 21000 and 54000, totaling ₹226000. That is a calculated sum of category maxima rather than regional sales of ₹412000.
Separate refreshed linked values from changing source extent
If you leave Create links to source data unchecked, the output is a snapshot you update by running the consolidation again. On a separate output sheet and a clean copy, enable Create links to source data if your client offers it. Excel can link calculations to sources on other worksheets. The option is unavailable when source and destination are on the same sheet. Inspect how your Excel build displays detail and formulas, and test one approved value change within an existing input before relying on automatic updates.
For example, temporarily change Pune Dairy from 52000 to 53000 in a copy. The adjusted source total for Pune is ₹152000. The new Dairy group total is ₹127000, and the complete regional total is ₹413000 after the linked calculation or a fresh manual consolidation. In the unchecked snapshot, the earlier Dairy result can remain ₹126000 until you rerun the operation. Compare both cases using their formula bars and approved scope. Restore 52000 before the next experiment, since keeping the change would alter later numbers.
A newly added row has a separate problem. Add Bakery and 15000 to Pune A5:B5 in an isolated copy. The old source selection Pune A1:B4 does not include it. Update the consolidation range to A1:B5, removing the prior Pune A1:B4 entry before consolidating. Simply adding both creates overlapping inputs and can count the original Pune records twice. The correct revised Bakery total is ₹36000 and regional total is ₹427000. Count for Bakery increases from one approved source row to two. A live link to a previously selected area is insufficient proof that a later row belongs to that area.
If you accidentally keep both Pune ranges in the reference list, every original Pune amount can contribute twice while new Bakery appears once. The result would be ₹578000 because the fully approved new total gains another ₹151000. Compare selected source ranges against the approved record roster. The command can accept two different addresses even though their rectangles overlap. This check is more precise than asking whether the output has the right number of category labels.
Prepare approved labels and choose the right combining operation
Standardize the same category in every source
Use the original text Dairy, Fruits, Snacks, Bakery and Home in the exercise. On a separate copy, someone could type Fruit instead of Fruits on Nashik’s tab. This is a genuinely different string and can be grouped separately. The Fruits label would then receive ₹97000 while Fruit receives ₹47000. The combined region total still reaches ₹412000. Find the mismatching label against the approved list and decide whether it is an alias for the same category before changing anything. A near spelling can also name a truly different group in another organization.
For recurring intake, keep original and canonical labels in separate fields or in a verified staging copy. An approved category map might contain Fruits as the standardized label for two known source spellings and flag an unknown label for review. A simple cleanup can remove unintended spaces, but two genuinely different names still need a business decision. Confirm that two different source concepts were not incorrectly merged by an overly broad rule. Compare the sum of accepted sales and the number of approved city-category rows before and after any mapping.
Use a direct formula check with the same source scope
Keep this test separate from the Consolidate output. In cells A2:A6 on a new check worksheet enter the five approved category names. Use the following row 2 formula to sum the matching values from each bounded source list. Copy it down while retaining the absolute address blocks. With Dairy in A2, the three SUMIF terms independently resolve to ₹52000, ₹33000 and ₹41000. The total checks the label-based command using visible method and address choices. This formula assumes exact approved printed labels without wildcard characters.
=SUMIF(Pune!$A$2:$A$4,A2,Pune!$B$2:$B$4)+SUMIF(Nashik!$A$2:$A$4,A2,Nashik!$B$2:$B$4)+SUMIF(Nagpur!$A$2:$A$5,A2,Nagpur!$B$2:$B$5)
Use similarly scoped COUNTIF expressions to check how many source labels matched. These count matching label rows even if the amount is inappropriate, so validate numeric coverage separately. A SUMIF contribution of zero can mean there was no matching label or that matching measured values added to zero. Look at the source records rather than inferring absence from zero. The first source selection remains deliberately short in this check. Extend the Pune formula scope as well when testing the approved Bakery append.
Distinguish consolidation, append and merge
Data Consolidate groups and aggregates the selected input positions or labels. Appending in Power Query stacks compatible input records while aligning columns by their headers. If a header is absent in one input, Power Query adds null in that output field for the affected rows. It does not infer which category values should be grouped. Expect ten rows from the three original datasets after a clean append. The rows still contain the separate city records if you add an explicit City field before appending. A later group operation or a PivotTable can then produce five category totals while keeping a route back to the ten evidence records.
Merging is a join. It matches values in one or more key columns between datasets. For example you could merge a city-category table with a verified category definitions table, using a unique category key to include the description. In that chosen left join preserve every approved city-category record and inspect any unmatched description. If the definitions source repeats the same key, expanding join results can duplicate rows and inflate the later sum. Appending two city tables does not require matching each row to a row in the other city. Describe the input and desired output before using a tool named Combine or Merge.
A familiar retail analogy is a fictional Amazon-style category report. If two offices submit subtotal rows, appending them does not recover the individual order histories they summarized. If the objective is to audit products sold by week, request source records at that approved grain and retain identifiers. If the goal is a small one-period sales report, the ten existing city-category summaries can suffice. Aggregating correct data never creates evidence at a more detailed level than the source supplied.
Practise both normal consolidation and a range revision
Lab 1. Produce the original category summary
- Enter the ten source rows and keep their original worksheet order. Save an untouched baseline before opening Consolidate.
- Use the three stated ranges and both label options. Check the five output values and separately confirm the ₹412000 total.
- Run a second consolidation on a blank destination with Count Numbers if available, or Count with the verified numeric inputs. Expected contributions are 3, 3, 2, 1 and 1 for the five listed categories.
- Compute the four positional formulas on a separate check sheet. Compare the first result of ₹128000 with the correct Dairy total of ₹126000. Show why the overall total can agree.
- Run the direct formula check if your client lacks Consolidate or if you want independent evidence. Match all five cell values before retaining the approved practice output.
Lab 2. Add an approved subtotal and test the replacement range
- On a copy with the original ten records, add Bakery and 15000 in Pune row 5. Record that the old reference ends at row 4.
- Update the Pune reference to A1:B5 and remove its old A1:B4 entry. Verify the original Nashik and Nagpur ranges remain unchanged.
- Regenerate the result. Reconcile Bakery at ₹36000 with two contributors and the grand total at ₹427000. The other four category totals remain as before.
- On another copy of the original, change the Pune Dairy amount to 53000. Compare the unchecked snapshot after the change with a regenerated or verified linked output. Restore the original value.
- On a separate copy change Nashik Fruits to Fruit, locate the split grouping, and restore the approved label. Record which test checked extent, which checked values, and which checked label meaning.
Use different sheet names for each completed exercise so the old output can remain as a control. When rerunning a smaller source set, place the result into a fresh area rather than relying on cells beyond the latest output to clear. Remove or archive prior trial ranges on the test copy only after verifying the new results. The approved original fixture should be usable again by the next student.
Keep enough evidence for somebody else to rebuild the report
Describe the input population before extending a range
A shop manager says “we added Bakery in Pune.” Clarify whether the row describes a newly approved category subtotal or a repeat of a subtotal already included under another label. If the manager reclassified part of Snacks into Bakery, you might need to move a verified amount between categories while keeping total Pune sales unchanged. In the original exercise the ₹15000 Bakery row is an additional approved amount. This rule gives the regional total its expected increase of ₹15000. Keeping an audit of approved row identities makes it possible to distinguish an addition from a reclassification next month.
Read the effect of a reclassification separately. On a scratch copy, reduce Pune Snacks from ₹38000 to ₹23000 and add a Pune Bakery subtotal of ₹15000. The two new Pune portions still add to ₹38000. With the revised source row included, regional Bakery becomes ₹36000 and Snacks becomes ₹52000. The grand total stays ₹412000. The unchanged total now describes the right financial scope under a changed classification. This differs from Lab 2, where Snacks remains ₹67000 and the total reaches ₹427000. Write down which operation you intend before diagnosing any expected result.
For a handoff record, name the reporting period and the source transactions or summaries that were actually approved, and mark which categories were imported and revised. Maintain the expected record count beside the expected total. Under the reclassification scenario, total money is unchanged and the count of city-category rows grows from ten to eleven because the category split adds a new line. That increase is consistent with the business instruction. A new count alone does not prove an overcount, and a flat total does not prove nothing moved.
Prevent a total row from becoming a product category
Some teams send exported worksheets with a grand total on the line after the detail. For Pune, that summary could be ₹151000 in row 5 of the original fixture. If it is labeled Total and you deliberately include A1:B5 anyway, the category-based consolidation receives an extra labeled amount. It can create a Total category beside Dairy and Fruits. Adding the output groups would then give ₹563000, exactly twice the Pune contribution plus the other cities. The subtotal was real; its place in the selected scope was wrong.
In the original new-Bakery scenario you intentionally widen Pune’s range into row 5 to capture a real category. In the extra-summary scenario you intentionally stop at row 4 to keep a rolled-up amount outside. The same row number calls for different choices because the business identities differ. Check the label and meaning of the last included row rather than following a mechanical rule to select through the last cell with content. A short list of valid category names helps flag totals, blank labels and report notes before any consolidation runs.
Check labels and amounts in separate columns before matching
Headers also participate in label matching. Suppose Nagpur changes its value heading to Net Sales while Pune and Nashik still say Sales. Examine the definition before editing. If the team adopted a new measure, a corresponding input cannot join the earlier Sales group without an approved interpretation. If only the heading changed and the column still uses the agreed measure, use a validated mapping or bring the header back to the canonical label. A category-matching tool can treat distinct labels as separate columns when the top row participates. A recognizable number under the wrong heading is still an incomplete report.
Hold the original extracts and apply any mapping in a controlled preparation area. For each city record, capture a City column, a category label, sales, and an approved period if the file can contain more than one. Keep the headings consistent. When matching categories, review the count of labels that were unchanged, mapped and rejected. Be prepared to explain how a broad label such as Home was defined. A tidy sheet can still combine unrelated categories when someone guessed that two names were synonyms.
Use a concrete copy test where two kinds of error give the same starting figure. Temporarily store Pune Dairy as a text string that looks like 52000. Its display can resemble the nearby numbers. Verify type with an ISNUMBER check or check numeric COUNT on the three sales cells before running Consolidate again. A genuine typed zero would pass a numeric test even though it changes the total. Preserve the initial value and review whether text is a valid report flag or a damaged numeric input. Correct it in a staging copy using the verified amount and check the final Dairy result returns to the approved ₹126000.
Preserve the meaning of signs and units
In a separate hypothetical review, Nagpur sends what looks like the original ₹36000 Fruits entry with a minus sign. A real net refund amount can be negative, so do not erase the sign or change the currency display to make it resemble the expected figure. If the measure is an approved net value, replacing +36000 with −36000 reduces the Fruits subtotal by ₹72000 to ₹72000. Nagpur's total becomes ₹88000 and the region becomes ₹340000. The source count stays ten. If that sign came from a file mistake, restore the amount only after the responsible source owner confirms it.
Units can create a similar mismatch with a plausible result. Amounts entered as 52 for thousands and 33000 for whole rupees are both numeric. They describe a common group only after conversion to the same approved unit. Standardize the amount type and scale before selecting the range, and put the unit in the heading or documentation. A number format can display a currency symbol but does not multiply an entered 52 into 52000. Keep a source-and-standardized value side by side during the review if some offices use different source conventions. This is a separate validation from the visible row label check.
Preserve detail for the next reporting question
A colleague might first need a five-row summary and later ask how much of total Fruits came from each city. The consolidated Fruits result of ₹144000 cannot on its own tell them which city supplied ₹61000. The appended and labeled source gives the answer directly. In a compatible client you can prepare each of these three city lists as a Table, add City in each one, and use Power Query Append as New. The three inputs should contribute three, three and four rows. After loading use a PivotTable or grouped query to show Sales by Category. If an external source is missing on refresh, verify the actual row count and city roster before distributing the new report.
Make a paper version of the appended table using the ten records on this page. Put the first Pune row in your check table with City Pune, Category Dairy and Sales 52000. Then combine the others without discarding any row. A second report grouped by City should reproduce ₹151000, ₹101000 and ₹160000, and a report grouped by Category should reproduce all five totals. This approach keeps a link between detail and both summaries. When writing the dimensions of the combined table, remember the input was one city-category subtotal per row. The new table still has that level of detail, even if every underlying city workbook originally used a transaction export somewhere else.
For a repeated process store the list of expected contributors and their intake dates in a review note. Keep any change to a schema separate from a routine increment in rows. When new records arrive for two different periods, use a period key in the appended source and give the report an explicit date filter. A summary that merely grouped category names would otherwise combine both periods. A reliable report states both the label by which it groups and the population it grouped.
Choose evidence that matches the next person’s task
- A manager reading a signed-off result. Show the approved category totals, reporting cutoff, and known coverage issues.
- An analyst updating the consolidation. Include exact source ranges, selected label options, chosen calculation and acceptance controls.
- A teammate investigating a grouping change. Keep the original source labels and reviewed mapping beside the approved category names.
- An auditor studying a repeated intake. Retain the accepted source record counts and measure totals by city, plus the consolidated result after approval.
Two unrelated reports can legitimately have the same total. Numbers are helpful evidence when paired with source identities and grouping rules. In a classroom handoff, let one student build the result with Consolidate and a second student independently recalculate it with the printed records or category formulas. Ask each student to explain what the tally of ten measures. If either answer is “orders,” revisit the source row definition. The exercise is complete when the two learners agree on inputs, outputs and meaning.
Record the actual label and source range beside each checked amount. A signed total is easier to reproduce when its contributing worksheet rows are named.
Recall how the categories and result values were chosen
Quiz
Why is adding B2 on each city sheet a bad Dairy total?
The B2 cells contain different labels. Their sum of ₹128000 combines Dairy, Fruits and Snacks. Match the Dairy label across its actual positions for ₹126000.
Does Home need to appear on all the sheets?
Label-based consolidation can include a label found only in one selected range. Home’s approved ₹54000 comes from Nagpur. An absent label is not proof of a measured zero elsewhere.
What happens after entering Bakery in Pune A5:B5?
The old A1:B4 selection leaves it out. Replace the old reference before rerunning. The approved grand total should grow to ₹427000.
Why is a count of three for Dairy not a transaction count?
Three numeric input records contributed, one summarized amount per city. You would need purchase-level records to count purchases.
What would the grand total tell you after Fruits was split into two labels?
It can still agree at ₹412000. Check the approved category set and reconcile the amounts against labeled records to catch the split.
Interview questions and answers
When would you choose consolidation by category?
When you need an aggregated result and the same approved labels can be in different positions. Confirm the source ranges, labels and row grain before using it.
When is a position-based calculation appropriate?
When every included address in the sources represents the same measure and category. Keep a verified common template and distinguish source headings, details and subtotals.
How do you verify a newly appended source category?
Check the approved source list and replace the old bounded range to include the new record once. Compare the new group contribution and region total separately.
What are the two main checks after a source update?
Verify source structure and membership first. Then verify the arithmetic and business meaning for each affected group, together with independent totals.
How would you choose between Consolidate, Append and Merge?
Use Consolidate for a smaller set of aggregated values. Append keeps all compatible source rows for later analysis. Merge joins tables using shared keys, so verify matches and row counts.
Revision cards
- By label. Match the category name even when its worksheet row differs.
- By position. Confirm each source position has a common meaning before adding it.
- Extent. Replace a changed source range and remove its superseded reference.
- Count. Describe what one numeric source record represents before interpreting it.
- Link option. A linked result can update approved values in its referenced scope. Verify structure after layout changes.
- Complete review. Compare group labels and counts as well as overall arithmetic.
See the original category consolidation illustration, use the Excel Practice Task Hub or continue to the quarter report capstone.
Microsoft references
- Position, category and platform checks for consolidation
- Source references, linked outputs and range maintenance
- Consolidation aggregation choices
- Append behavior by column name
- Merging data by shared keys
- Conditional arithmetic over source ranges
- Conditional counts and valid text criteria
- Checking measured numeric inputs with ISNUMBER