+ Reply to Thread
Results 1 to 9 of 9

matching the column with a value from pivot table

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    matching the column with a value from pivot table

    Hello,

    i have a challenging issue i cant handle
    at some place at my macro, im making a pivot table that counts an average value of all sales from every week that a product was sold.

    What i want to do is that macro would automatically puts an average value in newly build column (AVERAGE) just as You can see in the attached workbook
    What i cant figure out is how the macro would find that in column A is "product1" and put an average of all of the weeks in the new column (in all of the rows which are product1)
    and then do the same thing with the average of product 2.


    Best Regards
    mumsys
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: matching the column with a value from pivot table

    In this file, there is a recorded macro to made the Pivot Table (as shown in the file).
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: matching the column with a value from pivot table

    Hi thanks

    but that's not what i meant. I already have a pivot table (its in the attached workbook). All i need is a macro that would copy the average value of product1 to all of the rows where "product1" is in the column A in the table on the left. The column AVERAGE is an example how it supposed to look and what im trying to achieve hope its clear enough now

    Best Regards

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: matching the column with a value from pivot table

    Why use a formula, if you got an pivot table.

    The pivot tabel can do that for you.

    That's why i asumed you wanted a macro for that.

  5. #5
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: matching the column with a value from pivot table

    the thing is, that the table where the data should go may be in another workbook. So i need macro to copy the values from pivot table to matching places in the table.
    Product 1 - (average of all weeks sales of product1 f.e 10)
    Product 1 - 10
    product 1 - 10
    product 2 (average of all weeks sales of product2 f.e 20)
    product 2 - 20 etc

  6. #6
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: matching the column with a value from pivot table

    Hi, i still can't figure out how to pursue with my project

    In attached workbook i'm showing what i have (sheet1) and what should be the output (sheet2)
    I want macro to copy an average value from pivot and put in certain rows that match.

    Thank You in advance for help
    Attached Files Attached Files

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: matching the column with a value from pivot table

    maybe formula (in E2)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: matching the column with a value from pivot table

    Probably it's on me, but i still don't get why you can't use pivot table for that.

    Another solution would be using sumproduct (as Nilem suggest)

    but if it can be done with sumproduct, I think it also can be done with pivot table.

  9. #9
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: matching the column with a value from pivot table

    its because this operation is one of many operations that i'm doing with raw data by the macro. and i need this to happen :P

    Thanks nilem, that would work, but i'm thinking how it would fit if the table has randomly big amount of values.

+ 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] data not matching in Pivot table
    By cool.friend in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 06-23-2013, 12:35 PM
  2. Issue with filtering pivot table items depending on matching data.
    By Jyae in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 11:14 AM
  3. Replies: 1
    Last Post: 03-06-2012, 02:02 PM
  4. Matching Products in Pivot Table
    By mashley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2007, 12:07 PM
  5. [SOLVED] Pivot Table data not matching source
    By PC in forum Excel General
    Replies: 3
    Last Post: 07-21-2006, 12:50 AM

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