+ Reply to Thread
Results 1 to 8 of 8

Displaying Specific Values in Pivot Table

  1. #1
    Registered User
    Join Date
    10-13-2016
    Location
    Boston, Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Displaying Specific Values in Pivot Table

    Hello Everyone,
    I am trying to sort data within a Pivot Table. I would like the data to show which countries have the corresponding perils and catalog size. Is there a way to show an x or a value in the rows of the countries to indicate which country has which values? I've included possible examples displaying what I would like the future state to be.

    Can someone please assist with taking the current state to one of the example future states?

    Thanks in advance,
    PS
    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,957

    Re: Displaying Specific Values in Pivot Table

    This is a matter of “I get by with the help of my friends.” In this case, my friends are pivot tables. My philosophy is to get Excel to do as much of the work as possible and use VB to tie the pieces together.

    Future State 1 is a simple pivot table but instead of “X” you get a count of how many catalogs fit the Country / Peril combination. This is displayed on sheet FS1.

    I use this pivot table to get me the row and column headers for Future State 2 (FS2).

    I go down the countries and across the perils and use a helper pivot table in Columns N:O on the data sheet. By setting the country and peril filters, I get a list of catalogs that match. I use this list to compute the string.

    The value in Cell Q1 on the data sheet is a check to make sure I have data for a given Country / Peril combination.
    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
    10-13-2016
    Location
    Boston, Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Re: Displaying Specific Values in Pivot Table

    Thanks dflak for your assistance!

    I need some further clarification on the following questions regarding the spreadsheets you added to the workbook.
    • What does the number represent in cell Q1 on the Data sheet?
    • For example, if I select Australia as the country and All as the peril. The value changes to 5. Does that 5 represent the number of times Australia appears with perils?
    • If so, why when I leave Australia selected as the country and then select EQ as the peril, I end up receiving 4 as a value. After reviewing the original data, I see that Australia EQ only appears once.
    • On the spreadsheet entitled FS2, did you manually fill in the Catalogs in the cells across from the countries? Or use VB?

    Thanks,
    PS

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

    Re: Displaying Specific Values in Pivot Table

    I use the value in cell Q1 to keep me out of trouble while trying to loop through the list. There are three "headers" in the Q Column. So if there are two countries that meet the conditions of the filters, Q1 = 5. It's simply a count of all the non-blank cells in Column Q.

    So if Q1 > 3 then I have at least one item on the list and my code works. However if Q1 = 3, it means that there are no items on the list and if I try to loop through the list, the code may give me an error message.

    When you work with pivot tables, you have to do some extra checking. For example if you are trying to set a filter to a value, but that value doesn't exist in the pivot table, Excel will offer to change the current selection to that value and really screw things up. So, I like to check that there is at least on occurrence of the item before using it.

    As for FS2. I made the pivot table on FS1 mainly as a demonstration that you could get the first step of your request done with a pivot table alone without having to use VB code.

    I then used VB to copy the row and column headers to FS2.

    I could have eliminated this two-step by making the pivot table like I did in FS1 but leave out the values.

    If you want, I could give you a version without FS1. It was included only for proving a point. It's a minor code change.

    While I am explaining the list I should mention that it is a named dynamic range. Here is some information on named dynamic ranges: http://www.utteraccess.com/wiki/inde...Dynamic_Ranges.

    If you have any other questions on the code or dynamic ranges, feel free to ask.

  5. #5
    Registered User
    Join Date
    10-13-2016
    Location
    Boston, Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Re: Displaying Specific Values in Pivot Table

    Thanks again for the explanation regarding the value in cell Q1.

    I'm not as familiar with VB. I'll look more into it.

    If it's not too much trouble, I will take the version without FS1.

    Thanks for the dynamic range info. I will review it shortly.

    If I have additional questions, I'll ask.

    Thanks,
    PS

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

    Re: Displaying Specific Values in Pivot Table

    This this is a slightly "cleaner" version. It still has the FS1 page, but it is used to get the row and column headers (which it does with pivot tables) and for the scratch calculations for the catalog strings. I removed the scratch calculations from the data sheet to keep it "clean." You can hide the FS1 page.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-13-2016
    Location
    Boston, Massachusetts
    MS-Off Ver
    2010
    Posts
    4

    Re: Displaying Specific Values in Pivot Table

    Thanks dflak for all your help!

    The pivot table in the FS1 tab on a previous worksheet you uploaded was suitable for the project I was enlisted to solve.

    I'm still unsure how you was able to get the catalog values for the corresponding countries and perils in the FS2 tab on the last file you uploaded. Was it with the help of VB to get everything to tie in together?

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

    Re: Displaying Specific Values in Pivot Table

    In this version of the workbook - and even in the former version of the workbook, I accomplished the trick of getting the catalog values with the help of a pivot table. In the former version, this pivot table was on the data sheet. In the new version, it's on the FS1 sheet.

    I'm using the FS1 sheet as a "scratch" sheet to do calculations. The pivot table in Column A simply gets me a unique list of country names. I copy and paste this list to FS2. The pivot table in column C gets a list of the perils. I copy and paste this with a transpose to FS2.

    The pivot table in columns E:F does the work of finding the catalogs. First I go down the list of country names and I set the filter in cell F1 to the country name. While this name is set, I go down the list of perils and set the filter in cell F2. This gives me a list of all catalogs that are associated with the Coutnry / Peril pair.

    The code makes a string out of that. For example, for Country = Anguilla and Peril = TC, there are two catalogs: 10K and 50K.

    The number in cell H1 is used as a check. It's simply a COUNTA of column E. If it's 3 then it means the only thing in column E are the headers; no data is retuened, so I don't try to read the list and process it. If it's > 3 it means some data was returned and I should process the list.

+ 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: 0
    Last Post: 09-29-2016, 08:55 AM
  2. [SOLVED] Pivot table displaying ratio % values (20:80) from spreadsheet as '#DIV/0!' or '0'
    By henners2 in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 11-06-2015, 07:20 PM
  3. Replies: 12
    Last Post: 12-17-2013, 12:35 PM
  4. Pivot Table based on specific values from multiple columns
    By Jaypoc in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 06-22-2013, 12:33 PM
  5. pivot table from Power Pivot not displaying thousand separator/comma
    By Paul-NYS in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2013, 01:05 PM
  6. Count Specific values in a Pivot Table
    By rmikulas in forum Excel General
    Replies: 5
    Last Post: 09-10-2010, 10:01 AM
  7. Displaying more "Values" in pivot table
    By amirs318 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-28-2008, 06:44 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