+ Reply to Thread
Results 1 to 7 of 7

add a column (sort column) in vba pivot table

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    add a column (sort column) in vba pivot table

    I am very unversed in the magic of pivot tables ( never got one to work how I wanted it to), but with assistance from here have a pivot table output that saves much time.

    A change in reporting format has led to a requirement to catagorise the pivot table data by county. At present it takes and sorts by a column "Waste Facility" and sums totals of actual weights.

    I need to utilise a column in the data range "County" and add that to the pivot output so that the data is then sorted by county.

    Code for pivot table as is
    Please Login or Register  to view this content.
    Any pointers appreciated
    Last edited by nigelog; 01-24-2019 at 07:07 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: add a column (sort column) in vba pivot table

    You'll need to add it as a row field. If it's the primary sort field, it needs to be the first row field.
    Rory

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: add a column (sort column) in vba pivot table

    Hi Rory, these changes have given me a total of the number of waste facilities rather than the data in the column. I have moved the "County" column to "n" so the data is now contiguous
    Please Login or Register  to view this content.
    edit: by clicking on the table and clicking the checkbox for Waste Facility the data appeared how I need it. How can that be coded to do same??
    Last edited by nigelog; 01-24-2019 at 06:48 AM.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: add a column (sort column) in vba pivot table

    Why did you make Waste facility a data field?

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: add a column (sort column) in vba pivot table

    I see that I don't need to add it as a data field because the data is in the pivot table, I just need to click on the checkbox for it to appear.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: add a column (sort column) in vba pivot table

    You should have left it as a rowfield as you had it originally.

  7. #7
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: add a column (sort column) in vba pivot table

    Thanks Rory, got there
    Please Login or Register  to view this content.

+ 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] Sort pivot table by second column
    By jdfjab in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 10-10-2017, 04:39 PM
  2. Pivot Table: Two-column sort ?
    By Dave+ in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 09-20-2017, 06:50 AM
  3. [SOLVED] Sort Pivot Table by Column Subtotal
    By Tayque_J_Holmes in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-20-2016, 02:08 PM
  4. [SOLVED] Need to sort pivot table's column labels by type
    By adelkam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2015, 03:27 AM
  5. VBA to Sort Pivot Table (Specific Column)
    By AHFoddeR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2013, 02:39 AM
  6. Replies: 0
    Last Post: 11-11-2011, 04:10 PM
  7. [SOLVED] Sort a Column of Dates in Pivot Table
    By Linny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-22-2005, 09: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