+ Reply to Thread
Results 1 to 11 of 11

Histogram from a pivot table - plot empty bins as having frequency 0

  1. #1
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Histogram from a pivot table - plot empty bins as having frequency 0

    I've made a histogram from a pivot table by putting the the field "total (mm)" as my row labels. I've grouped these into bins of 20 and plotted against the "count of total (mm)". This produces a nice histogram except for the fact that it just doesn't display a bin if it is empty eg in the histogram, there is no data in the range 420-440mm and I would like it to plot a bar with 0 height but it tries to be helpful and plot nothing at all. Does anyone know how I can make it plot a bar with 0 height for an empty bin? I thought I could maybe enter some false data into my spreadsheet so that all bins have something in them but it seems like a really scrappy (not future-proof) way of doing it

    I've attached the histogram that is generated and the pivot table behind it.

    Thanks
    Attached Images Attached Images
    Last edited by 1992; 09-17-2012 at 07:00 AM.

  2. #2
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    Nobody know how to do this?

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    Really hard to help from just pictures, which is probably why no response.

    Try setting the Row Field options, Layout and Print > Show items with no data.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    I attached two pics in the original post, have they not worked? Your suggestion worked though, thanks

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    Pictures are not helpful for checking what setting you have used or seeing exactly what you data is.

    At best they only allow people to guess at what you have setup. Luckily for you I guessed right

  6. #6
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    Sorry I misread, I thought you meant that you couldn't see the picture.

    I've now encountered another problem which I've illustrated with a sample spreadsheet.

    When looking at the histogram produced, if you want to view the histogram without aluminium, you can untick it in the chart and it disappears but the axes don't readjust nicely. I need a way of hiding rows if they aren't contributing to the totals at the bottom but I'm not sure how to get it done

    Cheers
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    Seems like I have to decide between having axes which don't look right or missing bars, is this going to require VBA?
    Last edited by 1992; 09-18-2012 at 09:28 AM.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    Correct. By display zero data, in order to get all the bins included, it means all the bins are included even if they are zero.

    There is away around it but you need to add dummy records and add a new field.
    The Value field is used as the data and the Total field is used for row labels. You can then remove the show zero items from field.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    That looks and works really well thanks, but I'm stuck as my actual worksheet has lots of options for the metal and quite a few filters on the pivot table and about 1000 rows. I assume I'd need to make dummy records for all possible entries in order for it to work. I might have to give up on this as I don't think tidy axes are worth the trouble.

    Thanks

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    For each metal you would need a record for each band that the metal has data for.
    So in the example Copper starts at 11 and has records for 16,21,26,31,36 and 41 bins.

  11. #11
    Registered User
    Join Date
    08-16-2011
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Histogram from a pivot table - plot empty bins as having frequency 0

    The fact I have 5 filters which get used on the histogram means dummy records have to be added for each different combination of filters for the dummy records to take effect, otherwise they just get filtered out sometimes. I'd also need to keep adding more dummy records whenever the extrema of my data changed. Also, I have some other graphs in my worksheet which the dummy records interfere with so I don't think it's worth the effort of maintaining the workaround for the sake of tidy axes as it's tricky to generalize this method to a bigger set of data with more fields. Thanks for the help though.

    I can't really upload my worksheet to show you as I'm only a summer student at the company and I don't think my bosses would really want the data in the spreadsheet on the internet..

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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