+ Reply to Thread
Results 1 to 6 of 6

PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

  1. #1
    Registered User
    Join Date
    08-24-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

    EDIT: I've figured out a partial solution. I still need some help to automate the whole process. Please look at the attached sheet, if you'd like to help.


    Hey!

    I am trying to summarize the following data from a table:

    Value----To-------From

    100------John-----Lisa
    50-------Mike-----John
    30-------Sandra--John
    20-------Lisa------Mike

    ...

    to look like this in a PivotTable

    Agent----Total To----Total From----Balance

    John-----100----------80--------------20
    Lisa-------20---------100------------(-80)
    Mike------50----------20--------------30
    Sandra---30------------0--------------30


    Basically, I want to sum all values under the same name that are spread across multiple rows into a single row.

    Filtering doesn't help since it is row-based and can't be applied to multiple columns simultaneously. The PivotTable builder doesn't allow me to merge data from multiple columns either, and I don't know if consolidation ranges can help resolve this.

    The most elegant solution would be a flexible PivotTable which can combine relevant data from multiple rows into a single row without resorting to complex formulas or VBA scripts.

    Please note that the data set is a table where data will continue to be entered this way.

    Hope you wizards can figure this one out.
    Attached Files Attached Files
    Last edited by albatr0n; 08-24-2012 at 03:43 PM.

  2. #2
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

    Hello,

    With the way you have the data I could not provide the PIVOT TABLE the way you want. I don't even think it's possible due to what you have said - both names are in the same row and therefore don't quite know if there's a wayout of that situation without changing the way data is shown.


    One thing I do know - if you display the data in other way you could be able to do the PIVOT TABLE.

    I have attached an example.


    I know that probably it's not quite the answer you would like to read, but let's see if some other users (with more experience) have a look at this and get a better solution.



    Kind Regards,
    FCarv
    Attached Images Attached Images

  3. #3
    Registered User
    Join Date
    08-24-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

    FCarv, thanks a lot for chipping in. See, I don't mind an intermediary table or PivotTable that first summarizes the data by name, but what I can't change is the original data table, because it is the way users input the data in the most streamlined way.

    How many tables or transpositions of the original data will be needed is not that much of a concern, since they can be hidden from the user. But the solution, however, must allow for dynamic input of new data. In other words, I can't pause, copy/paste ranges to new sheets, transpose and re-analyze everything every time I want a report. This is why a final report in the form of a PivotTable that can be dynamically refreshed as new data gets entered is the optimal solution.

    Btw, can you think of a way I can create an intermediary table like the second one in your example that can be updated automatically?

  4. #4
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

    Yes, most certainly you can.
    I'll try to get back to you later on, hopefully with a solution.

    What I will try to do basically is the following:

    1. Create a macro that opens that file where users input the data, copy that same data, closes that file without saving changes, and then paste in the newly created workbook (Active)
    2. Changes the way the data is displayed into an alternative way
    3. Inserts a PIVOT TABLE

    If, meanwhile someone bumps into this topic and, having more experience with macros, decide to help you out, even better.
    Because with me it may take a while


    Rgds,
    FCarv

  5. #5
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

    Ok, it's not yet done, but I have already done the first part.

    In what regards the second part I will require some help in order to transpose the data from Sheet "User Input Data File" to Sheet "Report". I'm having dificulties displaying the data like that.

    Attached are the following files:
    Test.xlsx (It's the file where users input the data)
    Report.xlsx (it's the file I did create in order to help you)
    Example.xlsx

    So basically, you open this Report book and at "Main" Sheet press button Extract and open the Test book. This will copy the data from there to this book and name the sheet "User Input Data File".

    Then you go to "Main" sheet again and press button "Get Report" and that runs the second part, which will be transpose the data from the way it is to the way we desire and do a pivot table.


    Unfortunately my knowledge in VBA doesn't allow me to go further in step 2.
    Can someone help with the code to do the second part (it can be only the transpose part).

    We require the data to be like the one shown in the Example book.


    Rgds,
    FCarv
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-24-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: PIVOTTABLE: Group relevant data from across multiple rows under a single row label.

    @FCarv,

    Thanks a lot for your work!

    Your suggestion lead me to another strategy: combine the "To" and "From" columns into a single column, remove duplicate values and use SUMIF or another lookup function to extract and sum corresponding data in separate columns.

    This way value totals for each name will update themselves automatically, but I still can't figure out how to make the combined 'Name' column update itself dynamically when a new name is entered without using a macro.

    If someone can solve this, I'd be really grateful!

    Please look at the attached sheet.

    Thanks.
    Attached Files Attached Files

+ 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