+ Reply to Thread
Results 1 to 5 of 5

Drop lists to control pivot table

  1. #1
    Registered User
    Join Date
    06-29-2016
    Location
    Cape Town
    MS-Off Ver
    Office 2016
    Posts
    3

    Drop lists to control pivot table

    I am trying to compile a sales report in which end-user(s) can make various choices on what they want to valuate/view.
    In attachment you will find a table I worked out (on “Desired Results”-tab) which works perfectly the way I want the result to be. Due to the numerous formulas the document is very slow (calculation times up to 15min!) and is the file size too big for the end-user(s).
    Because of the size of the source data, +65K rows and growing, I looked at bringing in the data into a Data Model pivot table which would make calculations a lot faster and reduces the file size drastically.
    In this pivot table I want the end-user(s) be able to choose in the drop-down list in cell B2 the view-type in the row field being Agent, Consultant, Originator or Property. Problem is that source for each selection is situated in a different column in the data. I have scoured the net for days and came to a solution in taking out all the row field data and inserting the selection back in with vba. I found the here below code of Debra Dalgeish to remove all field rows

    Please Login or Register  to view this content.
    but ran into trouble with the “pf.Orientation=xlHidden” which gave me run-time error '1004': unable to set the orientation property of the pivot field class as a result. I suspect this has got something to do with the fact that I use a DM-pivot instead of a “normal” pivot but didn’t found a work-around this issue.
    Secondly, I would like to be able have a selector box (like a slicer) in cell D2 which eventually should show as a sum of the selections made in that selector box in the data field. Moreover, would it be possible to add in restrictions on certain combinations of selections please?
    Could anyone help me in my automation ordeal or are there perhaps better suitable solutions for what I am trying to achieve please?
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: Drop lists to control pivot table

    I have an work-around for part 1 and it doesn't involve VBA. I added a helper column to the source data called Row Header and used that in place of the Properties field in the pivot table. The formula is: =OFFSET([@Property],0,MATCH(Sales!$B$2,Tbl_Help[#Headers],0)-1)

    This formula finds the key word "Agent", "Property" or whatever is in Cell B2 on the Sales sheet and gets where that word appears in the table header and then offsets by that number of columns to get the appropriate value. You do have to refresh the pivot table after you do this.

    I'll need a bit more description on what you want in part 2 especially where you want to prohibit certain combinations. This part is probably going to take VBA.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    06-29-2016
    Location
    Cape Town
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: Drop lists to control pivot table

    Thank you very much dflak,

    Simple yet elegant! I like it a lot!!!

    For part 2 I don't want the end-user to be able to combine for instance bed nights with sales revenue (basically all the other categories in the Tbl_Help) because of it's nature. Bed nights are a count of events happening whereas the others are sales revenue. In order to avoid mistakes and misunderstanding at the end-user's side I want to prevent them to be able to make combinations that are "non-compatible" and non-relevant.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: Drop lists to control pivot table

    Somehow I wound up breaking the data model, but I pressed on using Tbl_Help. The result may be prohibitively slow. This is what I did.

    On the list sheet, I expanded the table for Revenue Type to include a Group column. Use this column to group those things that can be grouped together in a selection. It is up to you to make sure that the revenue types listed in the table match the column headers in the data.

    I made a pivot table of this data, and it is on the Revenue List sheet. I overlaid the results of the pivot table with a named dynamic range called Rev_Type I inserted a slicer for group and revenue type on the pivot table and moved them to the Sales sheet. If you select a group, you will be restricted to selecting only those types associated with the group. The slicer selections determine what is show in the pivot table which are the column headers of interest.

    Then I wrote a function that totals up the selected column headers and put this in a helper column called quantity.

    The pivot table uses Row Header and quantity.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-29-2016
    Location
    Cape Town
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: Drop lists to control pivot table

    It is indeed prohibitively slow as you mentioned. However, I do understand the mechanism you have built-in and believe that this is the way to go forward.
    Thank you very much dflak

+ 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. Replies: 5
    Last Post: 12-23-2016, 10:12 AM
  2. [SOLVED] Excel Updates have stopped vba coding from working and control boxes (drop down lists)
    By vkamp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-02-2015, 09:25 AM
  3. How to control user input on a multiple drop down lists?
    By rashedexcel2013 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-31-2013, 02:04 PM
  4. Pivot table - how to sort drop down lists?
    By 1eyedjack in forum Excel General
    Replies: 5
    Last Post: 04-19-2012, 08:07 AM
  5. [SOLVED] Drop down control pivot table but NOT overwrite value if not found
    By 4am in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-01-2012, 05:33 PM
  6. Pivot tables and drop-down lists
    By lorentzen in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-23-2006, 06:30 PM
  7. Pivot Table Drop Lists Out of Order
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2005, 03:05 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