+ Reply to Thread
Results 1 to 28 of 28

Pivot table or best summary table help

  1. #1
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Unhappy Pivot table or best summary table help

    Hi,

    Attached is an excel file with a lot of data (and more columns to come). I need help organizing all of this data and choosing the best way to do so (Ideally this can be done in a way that is easy to read.). I'm wondering if a pivot table is the way to go, and if so, please help me set it up.

    I have to:
    1) Group by Industry (column P).
    2) Compile average/median stats for each of the industry groups. (I will be adding many more columns)
    3) exclude those in column Z with an X.

    One suggestion: Having a summary that collapses below each sector, and then a summary of the sectors at the top or bottom.


    What is the smartest way to set this up that also makes sense given the layout?


    Thank you!!
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    I would use power query/Get and Transform. Bring all your data including column Z to PQ.
    Delete all rows having X in Column Z.

    Unpivot your data to put it in a normalized data set. Close and Load to Excel. Now you can do analysis based upon categories. You can pivot the data where necessary.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Can you help me set this up?
    I have never used get and transform before, but want to learn how to do it. Can you show me an example of what this will look like with my data?
    Also, do I first delete these rows having an X and then bring it into get and transform?
    "Unpivot your data" - what does that mean? Once it goes into get and transform - they put it into a pivot table?

    *** Is there a way to show a summary page by industry with this method?

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    I will run a scenario for you, but this is a very powerful piece of Excel. You may want to pick up the Book "M is for (Data) Monkey" by Ken Puls and Miguel Escobar. A great PQ tutorial. Available on Amazon. I will post back in a few minutes.

  5. #5
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Thank you!!!

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    First thing I did was replace all "-" in your original ws with zero (0). Then I removed the autofilter.
    1. I highlighted your table including column Z. Opened Get and Transform and selected from table/range
    2. I clicked on the column formerly Z and selected the filter. I unchecked those with an X and the rose were removed
    3. I then highlighted the last two columns and right clicked and selected remove columns
    4. With the data in PQ, I then moved by dragging the descriptive columns to the left as shown in the final layout.
    5. I next highlighted all the data columns and right clicked and selected Unpivot columns.
    6. On the Home tab, I selected close and load and the data was brought back to Excel as seen on the attached.
    7. Your data is now in a form that is normalized that you can do analysis by category. Using the built in Filter will allow you to compare
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Thank you. How would I get average and median stats by industry?
    Is there a way to have a separate summary page too that drives off of this?

    If I want to add more columns would I repeat this process you described?

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    For average and median, I would use the AverageIf function. Look at Techonthenet.com for syntax for the function or https://support.office.com/en-us/art...8-f7c5c3001690

    As to additional columns, you would use the same steps. I would urge you to look at getting the book I described as there are more advanced functions, you may find helpful.

  9. #9
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Thank you. Is there a way to also have a quick summary page?

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,242

    Re: Pivot table or best summary table help

    Just as an aside, there is another very recently published book by Gil Raviv that is highly recommended by me called Collect, Combine, and Transform Data Using Power Query in Excel and Power BI (Business Skills). Well worth the investment.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  11. #11
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    THANK YOU!! I can't wait to learn this!

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    Thanks Ali, just ordered it for myself.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,242

    Re: Pivot table or best summary table help

    Alan - very wise choice. Gil has a blog as well - you might want to bookmark it.

  14. #14
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    I have another question on this.
    I have to add columns - and the data will be pulled from factset. So this is data that can be continuously updated. Do I have to make this values to bring it into PQ or can it work as formulas that update with an outside program (Factset)?

  15. #15
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    If your dataset layout is complete, then any changes within the prescribed data set will update when you click on the refresh button in Excel. Sometimes you have to refresh twice. Once to update the excel table and the second to update the PQ data that is transported back to Excel.

  16. #16
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Hi Alan, Also - if I have hidden columns, do those stay hidden when it goes to PQ (I want it to stay hidden and not work with those columns but cant remove them bc other cells drive formulas off of them).
    Thanks

  17. #17
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    To be honest, I don't know. What happens when you test?

  18. #18
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    I am finally done updating all the columns.
    "First thing I did was replace all "-" in your original ws with zero (0). Then I removed the autofilter. " If I have columns with #N/A or #NUM - do I have to scrub those before they can be loaded into PQ or can I just leave all the "-", and NAs and NUMs...

  19. #19
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    It depends on what you are going to do with the errors when you get to PQ. If you are going to delete those lines then you do nothing and filter the rows out in PQ. If you need to keep them, then you will need to change them to a numerical value as they will conflict in PQ and you will not be able to get your results. Probably best to make them zero so they will be recognized as a numerical value.

    When I tried to work with your sample and not change the "-" to zero, PQ would not evaluate because you had a non numerical value in the column which was supposed to be numerical and it couldn't handle it.

  20. #20
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Unhappy Re: Pivot table or best summary table help

    Okay. I have re-attached my file now.

    1) Is there a querry in PQ that will create a summary table that shows the average and median for each sector across all the columns? That is my ultimate goal for today (I will have to learn this over the weekend and I ordered the book).
    2) Can you show me with the data?

    Thank you
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Another issue I have with get and transform is "multi cell arrays" aren't allowed... how do I keep the factset formulas so I can keep updating this data.. or do I have to paste it as values...

  22. #22
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    Is there a querry in PQ that will create a summary table
    Thinking that you may need to do this in Excel after completing the PQ. PQ is all about data manipulation.

    As to the "multi cell arrays", this is something I know nothing about. Sorry.

  23. #23
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    when I used group by sector to create the summary page (attached) the average and median that is coming up by sector doesn't match the data!? What did I do wrong? Please advise!

  24. #24
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    no attachment

  25. #25
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Question Re: Pivot table or best summary table help

    File should be attached now.
    Attached Files Attached Files

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,242

    Re: Pivot table or best summary table help

    Quote Originally Posted by dianaCatz View Post
    Hi Alan, Also - if I have hidden columns, do those stay hidden when it goes to PQ (I want it to stay hidden and not work with those columns but cant remove them bc other cells drive formulas off of them).
    Thanks
    Perhaps this explanation might help?

    When you upload data into the PQ editor, it does not make any changes at all to the underlying data. Whatever you do to the data in PQ will be reflected in the resulting table that you load back into the workbook, but the original underlying table will remain unaltered. To update the table created by PQ when you change data in the underlying table, you have to refresh the query.

    In order to create a summary table, you can open your query and, using the queries panel on the left of the PQ window (often minimised by default), right click the query and chose Reference. This makes a copy of the query which you can further manipulate into a summary table. When you close and load again, you will now have TWO PQ tables in your workbook. Each time you refresh the queries, they weill draw data from the one underlying table.

    This is all in Gil's book, so if you've bought that, you'll be able to find where he explains these processes.

  27. #27
    Forum Contributor
    Join Date
    01-16-2019
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    115

    Re: Pivot table or best summary table help

    Thank you! I got it to work. YEs - hidden columns do show up so it's best to create a copy of the sheet, paste as values, and just delete those columns. Thank you both so much for teaching me this new amazing part of excel!

  28. #28
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: Pivot table or best summary table help

    You are welcome. If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Pivot Table Summary -- Part #'s do not show in Pivot but data is in worksheet
    By maryren in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-19-2013, 10:51 AM
  2. [SOLVED] Can't get the desired summary (table, pivot table, ???)
    By jhren in forum Excel General
    Replies: 1
    Last Post: 05-24-2013, 07:33 AM
  3. Can't quite just use a pivot table for the summary I need...
    By ehralley in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 03-18-2013, 07:52 PM
  4. Replies: 12
    Last Post: 08-23-2012, 08:16 AM
  5. Need to rename sheets and automate pivot table and summary table
    By sameerk0286 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2010, 03:08 AM
  6. Replies: 2
    Last Post: 05-19-2010, 05:14 AM
  7. Summary table not using pivot table
    By chedges in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2007, 10:37 AM
  8. [SOLVED] PIVOT TABLE - Summary Table into a Databasae Table.
    By sansk_23 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2005, 03:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1