+ Reply to Thread
Results 1 to 5 of 5

A macro to create pivot table

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    San Diego, California
    MS-Off Ver
    2007
    Posts
    78

    Post A macro to create pivot table

    I want to consolidate all the rows with identical numbers in column G
    but I need column L from all of the consolidated rows be totaled together when they are collapsed.

    The attached file shows what I need before and after.

    The information in columns F, I and K is not very important for what I need.
    F and K will usually be the same value, but column I will almost always be unique for each row.
    However this is handled doesn't really matter.

    Can this be done with a pivot table? If so, I could really use a macro to turn it into one.

    ** UPDATE**

    I have created a macro to format the information correctly
    Now I just need the macro to convert the data to a pivot table
    Attached Files Attached Files
    Last edited by WorldBridge; 11-21-2011 at 06:26 PM. Reason: more appropriate title

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: A macro to collapse and total rows

    If you arranged the data into a proper Excel table format then you would be able to use a PivotTable or AutoFilter with a SubTotal formula
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-16-2011
    Location
    San Diego, California
    MS-Off Ver
    2007
    Posts
    78

    Post Re: A macro to collapse and total rows

    Thank you, I came to the same conclusion myself.
    The issue is that Quickbooks outputs to this format so I have little choice.


    I've figured out exactly what I need to do to organize the data how I need.

    Now I would like a macro to automate the tasks (it's for someone who's not very comp literate)

    Here's a list of the tasks;
    Delete column D
    Add "Job" title to cell C1
    Copy appropriate job title down column C
    (C3 copied to cells C4-C24)
    Unnecessary rows deleted
    (totals and job headings i.e. rows 2-3, 25-28)

    Then the sheet should look like "middle step"

    Then I'm sure there's an easy macro to convert the data to a pivot table
    setup for pivot table;
    Report Filter: Date
    Column Labels: Source Name
    Row Labels: Job
    Values: Sum of amount

    Finally it would be amazing if it made a freeze pane
    (in my example cell B5)

    **I've never worked with macros but I'm very computer savvy so I could put several together if need be**
    Attached Files Attached Files

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: A macro to create pivot table

    As per your last update, you mentioned that you already have the code to automate the steps. Find the code below to create the pivot -
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Registered User
    Join Date
    11-16-2011
    Location
    San Diego, California
    MS-Off Ver
    2007
    Posts
    78

    Re: A macro to create pivot table

    I was new to macros when I posted this. The answer was easy enough: I needed to record a macro and then adjust the necessary variables etc...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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