This page is an advertiser-supported excerpt of the book, Learn Excel 2007-2010 from MrExcel - 512 Excel Mysteries Solved. If you like this topic, please consider buying the entire e-book.
Use Consolidation to Combine Two Lists
Problem: Jerry and Tina each compiled sales figures from paper invoices. I need to combine Jerry and Tina’s list into a single list. Some customers are in both lists.
Figure 704 Combine the lists into a single list.
Strategy: Excel offers a great tool for consolidating data. Here’s how you use it:
1. Move the cell pointer to a blank area of the worksheet. You will need a blank area with several rows and a few columns.
2. Select Data, Consolidate.
3. Make sure that both boxes under Use Labels In are checked. This means that Excel relies on the headings to be the same and that the customer field is in the left column of each range.
4. Put the cell pointer in the Reference field. Click the Collapse button at the right end of the Reference field. With the mouse, select the first range: A1:B23. Click the Collapse button again to return to the Consolidate dialog.
Note: There are times when you will want to consolidate just a single range of data. This would be effective if you needed to combine duplicate customers from one list. However, in this example, you need to combine two lists.
5. Click the Add button to move the first reference from the Reference field to the All References box.
6. After the first reference is added to the All References box, click the Collapse button again to specify the second reference.
7. Use the mouse to select D1:E23. Click the Collapse button to return to the Consolidate dialog. Click the Add button to add the reference to the All References list. The Consolidate dialog should appear as below
Figure 705 Make sure both ranges are in the All References box.
8. Choose OK. In a few seconds, Excel will return a brand new list that extends down and to the right from your starting cell. The list will contain one instance of each customer along with the total revenue from the customer.
Figure 706 Excel combines the two lists into a single list.
Gotcha: The new list is not in any sequence. You can see that it kind of starts out in the sequence of the first list but then randomly inserts customers from the second list. You will probably want to sort the list alphabetically or by revenue. However, Excel always fails to fill in the label in the upper-left corner of the consolidation. If you want to sort the result, you need to type the word Customer in cell G2.
Additional Details: The Function box in the Consolidate dialog offers many functions other than SUM. For instance, if you want to find the largest purchase by each customer, you can use the MAX function.
Figure 707 Consolidate offers more than just SUM.
Gotcha: The results of the consolidation are all static values. If you change an item in the original list, the consolidation will not automatically update. This is good because it allows you to delete the original two lists and keep just the new list.