+ Reply to Thread
Results 1 to 4 of 4

Multiple Rows per Category, Making a PivotTable

  1. #1
    Registered User
    Join Date
    10-04-2019
    Location
    Portland, Oregon
    MS-Off Ver
    2019
    Posts
    2

    Multiple Rows per Category, Making a PivotTable

    Hi all,

    I am trying to figure out how to make a pivot table where there are multiple items (rows) associated with a single location (column).

    For example a single hospital may purchase multiple types of medical devices. How do I create a pivot table that understands to group all of the different items under a single hospital, and do this for multiple hospitals?

    Since I am a new user it will not allow me to post an image. For example cell A1 contains "XYZ Hospital". Cell b1 contains "Knee Replacements", cell b2 contains "Hip Replacements. Cell b3 contains (Rotator Cuff Repair", etc. Cells a2 through a3 are blank, as the name of the hospital appears only once in cell a1, and you can see visually that cells b1:b7: contain items associated with the hospital from cell a1. I hope this makes sense.

    I want to be able to create a pivot table, filter by hospital, and have each item the hospital purchased appear in the pivot table. Currently, only the item b1 (the same row as the hospital name) appears.

    Thanks for your help with this one.
    Last edited by Khax; 10-04-2019 at 04:23 AM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Multiple Rows per Category, Making a PivotTable

    Welcome to the forum

    This will be much more effective if we demonstrate using your data, rather than talking in general principles.

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    10-04-2019
    Location
    Portland, Oregon
    MS-Off Ver
    2019
    Posts
    2

    Re: Multiple Rows per Category, Making a PivotTable

    Hi Olly,

    Apologies -- I've attached a sample of what I am attempting to do here. Essentially, I'd like the filter in the "Pivot Table Mockup" tab to be able to filter by hospital to include each item, not just the one in the cell to the right of it, as you can see is the case in the "Pivot Table" tab.

    I know it will look a little different than the mockup if I am able to do it correctly, but that is as close as I can get it manually.

    Thanks for the help.
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Multiple Rows per Category, Making a PivotTable

    To pivot data effectively, your source data needs to be normalised - that is, each row contains a fact (or facts), and all the dimension values which describe that fact.

    In your case, your source data has a blank value for the location dimension, in many cases.

    I'd suggest using Power Query (Get & Transform data) to transform (normalise) your source data, then you can create your pivot table based on that. You just need a fairly simple query to fill down the Location values, and remove the Items subtotal rows.

    Format your source data as a table, then use:

    Please Login or Register  to view this content.
    Now pivot on this. See attached workbook for an example.
    Attached Files Attached Files

+ 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. Send Multipage Userform CheckBox Selections to Multiple Rows of Category
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2014, 10:28 AM
  2. [SOLVED] Duplication Of Name Category In PivotTable
    By i82 in forum Excel Charting & Pivots
    Replies: 11
    Last Post: 03-14-2013, 03:14 AM
  3. [SOLVED] Duplication Of Category In PivotTable
    By i82 in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-01-2013, 04:06 AM
  4. Shift rows below PivotTable down when PivotTable expands (PowerPivot)
    By hektisk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2012, 10:19 PM
  5. Replies: 2
    Last Post: 09-14-2012, 04:31 AM
  6. PivotTable Issue - same category is being duplicated
    By MitchT in forum Excel General
    Replies: 2
    Last Post: 06-08-2012, 04:49 PM
  7. Replies: 0
    Last Post: 10-02-2007, 06:41 PM

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