+ Reply to Thread
Results 1 to 3 of 3

combine 2 worksheets together with Pivot

  1. #1
    Registered User
    Join Date
    11-28-2016
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    20

    combine 2 worksheets together with Pivot

    Hi, I tried to combine 2 worksheets together.
    made them 2 tables and i can find them in pivot table. however, when i clicked "relationship" in the ribbon of the excel and tried to connect 2 together by setting "contract No"as the column to connect them, it always says "both selected columns container duplicate values. At least one of the columns selected must contain only unique values to create a relationship between the tables".

    What I am trying to do is, one sheet is for incoming inventory with one contract number. the other sheet is for outgoing orders. several orders can be under one contract. it means, we import a bigger tonnage and divide them into deliveries with smaller quantities, and I also would like to know the remaining quantity for each contract after several deliveries.

    i don't know what i have done wrong but I couldn't connect them.
    Could someone tell me what I should do please?
    Thank you!
    Attached Files Attached Files
    Last edited by danielpak; 05-29-2020 at 09:35 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: combine 2 worksheets together with Pivot

    Hi danielpak,
    Convert each dataset to a table (Ctrl + T). In the attached they are now Table1 & Table 2.
    Create a Pivot table from one of the tables and click "Add this data to the Data Module" (bottom of dialog box).
    On the Pivot Field Selector, on the top right under the heading "PivotTable Fields" you will see; Active All
    Click Edit Relationship. Link the tables (see screenshot).
    In the Field Selector you now can see the Table1 and Table2. Expand to select fields you need.
    Trust this helps.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ORoos; 05-29-2020 at 09:56 AM. Reason: Add Screenshop

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,902

    Re: combine 2 worksheets together with Pivot

    Using Power Query (Available on the Data Tab), I brought each table into PQ. Removed columns not required (kept Contract Nr. and Bags.) Joined the two tables with a Left Inner Join. Netted In and Out. See the attached file.Review PQ

    In the attached file
    Click on any cell in the new table
    On the Data Tab, click on Queries & Connections
    In the right window, double click to open Query
    Review PQ steps
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Power Pivot to Combine Multiple Pivot Tables
    By chrapm1 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 06-07-2018, 04:20 PM
  2. Need to combine data from two worksheets to create pivot.
    By Kidsmoke117 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-23-2014, 04:45 PM
  3. [SOLVED] Using Combine macro to combine multiple worksheets - need to modify to paste formulas
    By DLSmith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2012, 09:07 AM
  4. [SOLVED] combine two worksheets
    By sahatfield in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-16-2011, 02:57 AM
  5. Combine worksheets if...
    By Airgaf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-05-2011, 01:05 PM
  6. [SOLVED] I need to combine two excel worksheets in one pivot table.
    By Ellie in forum Excel General
    Replies: 5
    Last Post: 08-16-2006, 11:30 AM
  7. [SOLVED] Can I combine two huge worksheets into one pivot?
    By Saddy in forum Excel General
    Replies: 1
    Last Post: 02-16-2005, 03:51 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