Excel 2016 Pivot table or Consolidate or ?

%3CLINGO-SUB%20id%3D%22lingo-sub-1558779%22%20slang%3D%22en-US%22%3EExcel%202016%20Pivot%20table%20or%20Consolidate%20or%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1558779%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20large%20workbook%20with%2077%20tables%20of%20data.%20Each%20table%20is%20a%20list%20of%20parts%20that%20go%20into%20an%20assembly.%20The%20tables%20are%20very%20similar%20(Same%20headings%20and%20same%20number%20of%20columns)%20but%20with%20slightly%20different%20parts%20for%20each%20assembly%20and%20a%20few%20more%20rows%20in%20some%20than%20others.%20I%20need%20to%20consolidate%20the%20data%20from%20these%20tables%20when%20an%20assembly%20is%20purchased%20from%20us.%20For%20example%2C%20there%20could%20be%201%20of%20the%20assembly%20on%20Table%201%2C%203%20of%20assembly%20on%20Table%207%2C%20etc.%20I%20need%20to%20know%20which%20part%20we%20will%20need%20to%20order%20to%20make%20up%20those%20assemblies.%3C%2FP%3E%3CP%3EShould%20I%20use%20a%20Pivot%20Table%20or%20a%20Power%20Query%20or%20Consolidate%20or%20what's%20the%20best%20way%20to%20accomplish%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1558779%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1558877%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%202016%20Pivot%20table%20or%20Consolidate%20or%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1558877%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F746102%22%20target%3D%22_blank%22%3E%40Briankf%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20were%20doing%20it%2C%20I'd%20approach%20it%20as%20I'll%20describe%20below.%20One%20of%20the%20lovely%20things%20about%20Excel%20is%20that%20there%20are%20always%20multiple%20ways%20to%20accomplish%20an%20objective.%20Fortunately%20you've%20done%20a%20pretty%20good%20job%20of%20describing%20your%20objective.%20I%20fully%20expect%20that%20somebody%20is%20going%20to%20come%20along%20and%20give%20you%20a%20Power%20Query%20solution.%20I'm%20old%20school%20enough%20(which%20is%20to%20say%2C%20I%20learned%20Excel%20before%20Power%20Query%20came%20along%2C%20and%20haven't%20yet%20successfully%20mastered%20it)....but%2C%20with%20that%20as%20the%20up%20front%20disclaimer%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20a%20big%20believer%20in%20using%20a%20single%20table%20(aka%20database)%20whenever%20that%20can%20work.%20Excel%20is%20remarkably%20powerful%20when%20we%20need%20to%20extract%20data%20from%20that%20table.%20So%2C%20in%20your%20case%2C%20given%20that%20each%20of%20your%2077%20sheets%20is%20arrayed%20similarly%20(I%20think%20identically%2C%20except%20for%20numbers%20of%20rows)...%3C%2FP%3E%3COL%3E%3CLI%3EI'd%20make%20them%20all%20one%20big%20database%2C%20simply%20adding%20a%20column%20that%20differentiates%20which%20assembly%20a%20given%20row%20refers%20to.%20(Doing%20this%20would%20still%20allow%20you%20to%20readily%20create%20any%20one%20of%20the%2077%20distinctive%20lists%20by%20using%20FILTER%20and%20simply%20setting%20the%20criterion%20to%20the%20desired%20assembly%20descriptor.)%3C%2FLI%3E%3CLI%3EAnd%20then%20the%20Pivot%20Table%20would%20work%20to%20do%20that%20consolidation%20you're%20asking%20for.%3C%2FLI%3E%3C%2FOL%3E%3CP%3EI%20am%20assuming%2C%20since%20you've%20clearly%20been%20doing%20this%20kind%20of%20thing%20and%20asked%20about%20it%2C%20that%20you're%20proficient%20enough%20with%20Pivot%20Tables%20to%20know%20how%20to%20use%20its%20features%20to%20define%2Ffilter%2Fdisplay%20the%20kinds%20of%20results%20you're%20looking%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20that's%20this%20man's%20way%20to%20tackle%20your%20task.%20Now%20I'm%20going%20to%20watch%20to%20see%20what%20other%20solutions%20come%20forth.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1559823%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%202016%20Pivot%20table%20or%20Consolidate%20or%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1559823%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F746102%22%20target%3D%22_blank%22%3E%40Briankf%3C%2FA%3E%26nbsp%3B%2C%20Power%20Query%20can%20help%20with%20this%20really%20easily.%20See%20attached%20example%20with%20made%20up%20data.%20Here's%20the%20M-Code%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powerquery%22%3E%3CCODE%3Elet%0A%20%20%20%20Source%20%3D%20Excel.CurrentWorkbook()%2C%0A%20%20%20%20%23%22Filtered%20Rows%22%20%3D%20Table.SelectRows(Source%2C%20each%20Text.StartsWith(%5BName%5D%2C%20%22Input%22))%2C%0A%20%20%20%20%23%22Removed%20Other%20Columns%22%20%3D%20Table.SelectColumns(%23%22Filtered%20Rows%22%2C%7B%22Content%22%7D)%2C%0A%20%20%20%20%23%22Expanded%20Content%22%20%3D%20Table.ExpandTableColumn(%23%22Removed%20Other%20Columns%22%2C%20%22Content%22%2C%20%7B%22ID%22%2C%20%22Make%22%2C%20%22Model%22%2C%20%22Year%22%7D%2C%20%7B%22ID%22%2C%20%22Make%22%2C%20%22Model%22%2C%20%22Year%22%7D)%0Ain%0A%20%20%20%20%23%22Expanded%20Content%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20Excel.CurrentWorkbook()%20function%20will%20give%20you%20the%20list%20of%20all%20tables%20in%20the%20current%20workbook.%20You%20just%20need%20to%20filter%20the%20ones%20you%20need%20to%20keep%20(I%20kept%20the%20ones%20that%20start%20with%20the%20%22Input%22%20in%20the%20example)%20and%20expand%20the%20tables%20to%20get%20your%20consolidated%20table.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPerhaps%20this%20is%20the%20way%20to%20consolidate%20all%20the%20data%20into%20one%20as%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%20points%20out%20and%20then%20use%20it%20as%20your%20source%20for%20further%20analysis.%20I'm%20still%20learning%20the%20nuances%20of%20Power%20Query%20and%20trust%20in%20the%20wisdom%20of%20those%20that%20have%20done%20Excel%20modeling%20much%20longer%20than%20I%20have.%20Hope%20this%20is%20along%20the%20lines%20of%20what%20you%20are%20looking%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I have a large workbook with 77 tables of data. Each table is a list of parts that go into an assembly. The tables are very similar (Same headings and same number of columns) but with slightly different parts for each assembly and a few more rows in some than others. I need to consolidate the data from these tables when an assembly is purchased from us. For example, there could be 1 of the assembly on Table 1, 3 of assembly on Table 7, etc. I need to know which part we will need to order to make up those assemblies.

Should I use a Pivot Table or a Power Query or Consolidate or what's the best way to accomplish this?

2 Replies

@Briankf 

 

If I were doing it, I'd approach it as I'll describe below. One of the lovely things about Excel is that there are always multiple ways to accomplish an objective. Fortunately you've done a pretty good job of describing your objective. I fully expect that somebody is going to come along and give you a Power Query solution. I'm old school enough (which is to say, I learned Excel before Power Query came along, and haven't yet successfully mastered it)....but, with that as the up front disclaimer

 

I'm a big believer in using a single table (aka database) whenever that can work. Excel is remarkably powerful when we need to extract data from that table. So, in your case, given that each of your 77 sheets is arrayed similarly (I think identically, except for numbers of rows)...

  1. I'd make them all one big database, simply adding a column that differentiates which assembly a given row refers to. (Doing this would still allow you to readily create any one of the 77 distinctive lists by using FILTER and simply setting the criterion to the desired assembly descriptor.)
  2. And then the Pivot Table would work to do that consolidation you're asking for.

I am assuming, since you've clearly been doing this kind of thing and asked about it, that you're proficient enough with Pivot Tables to know how to use its features to define/filter/display the kinds of results you're looking for.

 

So that's this man's way to tackle your task. Now I'm going to watch to see what other solutions come forth.

@Briankf , Power Query can help with this really easily. See attached example with made up data. Here's the M-Code:

let
    Source = Excel.CurrentWorkbook(),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "Input")),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Content"}),
    #"Expanded Content" = Table.ExpandTableColumn(#"Removed Other Columns", "Content", {"ID", "Make", "Model", "Year"}, {"ID", "Make", "Model", "Year"})
in
    #"Expanded Content"

 

The Excel.CurrentWorkbook() function will give you the list of all tables in the current workbook. You just need to filter the ones you need to keep (I kept the ones that start with the "Input" in the example) and expand the tables to get your consolidated table. 

 

Perhaps this is the way to consolidate all the data into one as @mathetes  points out and then use it as your source for further analysis. I'm still learning the nuances of Power Query and trust in the wisdom of those that have done Excel modeling much longer than I have. Hope this is along the lines of what you are looking for.