Pivot table display text in column rather than count

  • In pivot table, I want it to display the name, then under it the project id and next to the project name the comments in a separate column then show the spent amounts in the subsequent columns. Not sure how to get it correctly show using VBA.


    Data:
    [TABLE="class: grid, width: 347"]

    [tr]


    [td]

    Name

    [/td]


    [td]

    Project

    [/td]


    [td]

    Comments

    [/td]


    [td]

    month1

    [/td]


    [td]

    month2

    [/td]


    [/tr]


    [tr]


    [td]

    name1

    [/td]


    [td]

    proj1

    [/td]


    [td]

    comm1

    [/td]


    [td][/td]


    [td]


    [/td]


    [/tr]


    [tr]


    [td]

    name1

    [/td]


    [td]

    proj2

    [/td]


    [td][/td]


    [TD="align: right"]160[/TD]
    [TD="align: right"]155[/TD]

    [/tr]


    [tr]


    [td]

    name2

    [/td]


    [td]

    proj1

    [/td]


    [td][/td]


    [TD="align: right"]120[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td]

    name2

    [/td]


    [td]

    proj2

    [/td]


    [td]

    comm2

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    name3

    [/td]


    [td]

    proj1

    [/td]


    [td]

    comm1

    [/td]


    [TD="align: right"]120[/TD]
    [TD="align: right"]200[/TD]

    [/tr]


    [/TABLE]


    Pivot table:
    [TABLE="class: grid, width: 215"]

    [tr]


    [td]

    Row Labels

    [/td]


    [td]

    month1

    [/td]


    [td]

    month2

    [/td]


    [/tr]


    [tr]


    [td]

    name1

    [/td]


    [TD="align: right"]160[/TD]
    [TD="align: right"]155[/TD]

    [/tr]


    [tr]


    [td]

    proj1

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    comm1

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    proj2

    [/td]


    [TD="align: right"]160[/TD]
    [TD="align: right"]155[/TD]

    [/tr]


    [tr]


    [td]

    (blank)

    [/td]


    [TD="align: right"]160[/TD]
    [TD="align: right"]155[/TD]

    [/tr]


    [tr]


    [td]

    name2

    [/td]


    [TD="align: right"]120[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td]

    proj1

    [/td]


    [TD="align: right"]120[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td]

    (blank)

    [/td]


    [TD="align: right"]120[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td]

    proj2

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    comm2

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    name3

    [/td]


    [TD="align: right"]120[/TD]
    [TD="align: right"]200[/TD]

    [/tr]


    [tr]


    [td]

    proj1

    [/td]


    [TD="align: right"]120[/TD]
    [TD="align: right"]200[/TD]

    [/tr]


    [tr]


    [td]

    comm1

    [/td]


    [TD="align: right"]120[/TD]
    [TD="align: right"]200[/TD]

    [/tr]


    [tr]


    [td]

    Grand Total

    [/td]


    [TD="align: right"]400[/TD]
    [TD="align: right"]355[/TD]

    [/tr]


    [/TABLE]


    This is how I want it to appear:
    [TABLE="class: grid, width: 347"]

    [tr]


    [td]

    Row Labels

    [/td]


    [td]

    Comments

    [/td]


    [td]

    month1

    [/td]


    [td]

    month2

    [/td]


    [/tr]


    [tr]


    [td]

    name1

    [/td]


    [td][/td]


    [TD="align: right"]160[/TD]
    [TD="align: right"]155[/TD]

    [/tr]


    [tr]


    [td]

    proj1

    [/td]


    [td]

    comm1

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    proj2

    [/td]


    [td][/td]


    [TD="align: right"]160[/TD]
    [TD="align: right"]155[/TD]

    [/tr]


    [tr]


    [td]

    name2

    [/td]


    [td][/td]


    [TD="align: right"]160[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td]

    proj1

    [/td]


    [td][/td]


    [TD="align: right"]120[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td]

    proj2

    [/td]


    [td]

    comm2

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    name3

    [/td]


    [td][/td]


    [TD="align: right"]120[/TD]
    [TD="align: right"]200[/TD]

    [/tr]


    [tr]


    [td]

    proj1

    [/td]


    [td]

    comm1

    [/td]


    [TD="align: right"]120[/TD]
    [TD="align: right"]200[/TD]

    [/tr]


    [tr]


    [td]

    Grand Total

    [/td]


    [td][/td]


    [TD="align: right"]400[/TD]
    [TD="align: right"]355[/TD]

    [/tr]


    [/TABLE]


    This is the code I have so far:



    Thanks..

  • Re: Pivot table display text in column rather than count


    Play around with the Pivot table to get it looking exactly like you want it using the Pivot Wizard... get it so you can do it in as few steps as possible. When you have it "down" to a few mouse clicks, start from fresh again with macro recorder turned on. I never "program" Pivot tables directly. I always record macros and manipulate the resulting code. I would propose that if you cant make the Pivot table look like you want it to look via the Pivot Wizard, you wont be able to write/amend VBA code for it.


    I deleted your duplicate post and added code tags around your code. Please add code tags in future. Thank you and welcome to the forum.


    Regards
    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Pivot table display text in column rather than count


    Thanks for cleaning up the post. I've tried several methods for getting the pivot table to do what I want both manually & with code, but no luck. So decided to throw it out to the masses.

  • Re: Pivot table display text in column rather than count


    Admittedly a difficult task.
    If you upload your complete, sanitized file,
    I might write a custom code for you.

  • Re: Pivot table display text in column rather than count


    Herbds7, did you see my post asking to post your code here on the forum?


    Thanks,
    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Pivot table display text in column rather than count


    Here is the code:




Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!