+ Reply to Thread
Results 1 to 6 of 6

Merge tables with x & y exceptions

  1. #1
    Registered User
    Join Date
    01-26-2018
    Location
    Paris
    MS-Off Ver
    O365 (PC) v.2202
    Posts
    12

    Merge tables with x & y exceptions

    Hey guys,

    Hope you are well. Quick question: basically I have 2 tables on two defferent sheets

    - Both have the same column headers (example: Customer number,Revenue, Costs, Gross profit, Signings).
    - First table is for let's say Q3 and second is for Q4.
    - In column A I have the customer number that often matches between the two tables, nevertheless I have customers that are not present in both Q3 and Q4 statements. Let' say in Q3 I had revenue from Google but not in Q4 anymore. While now in Q4 I have two new clients and revenue stream from Amazon and Facebook.

    What I want to do is two merge both these tables taking into account the exceptions and adding an "under-header" Q3 and Q4. At first I wanted to Run query and stuff but I imagine it wont do this exception.

    More precisely I want my new merged table to incorporate an "under-header" with a column for numbers coming from Q3 and numbers coming from Q4 while in parrallel adding horizontally my new lines of customers.

    I have tried with VBA but I am a real beginner and don't have enough expertise I am going nowhere since 3hours.

    Do you guys have any hints on how I could solve that?

    Thanks in advance for your help&time :)

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Merge tables with x & y exceptions

    This sounds pretty straightforward with Power Query (Get & Transform Data), but it will be much easier to demonstrate if we see the structure of your workbook.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    01-26-2018
    Location
    Paris
    MS-Off Ver
    O365 (PC) v.2202
    Posts
    12

    Re: Merge tables with x & y exceptions

    Hey,

    Thanks for your detailed answer. Here is a mock copy of what I would like to do. 3 sheets, 2 different tables and 1 sheet for merged.

    Cheers!
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Merge tables with x & y exceptions

    Okay - this is made a bit more complicated as your table headers span two rows, and your data is denormalised (looks like a report output - would be nicer to hit the data behind that report directly!)

    First step: Format your two datasets as tables - with no headers. Doesn't matter what the table names are.

    Now, in Power Query, add the following queries:

    fnNormalise:
    Please Login or Register  to view this content.
    Combined Tables:
    Please Login or Register  to view this content.
    Close and Load To 'Only Create Connection' and 'Add this data to the Data Model'

    Now you can use PowerPivot to create a flattened pivot table to suit your required output.

    See attached file for worked example.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-26-2018
    Location
    Paris
    MS-Off Ver
    O365 (PC) v.2202
    Posts
    12

    Re: Merge tables with x & y exceptions

    I am always surprised at how people are nice & dedicated on this forum. It's incredible. Thanks a lot for your time & help this is perfect.

    Cheers!

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Merge tables with x & y exceptions

    Happy to help! If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You can also 'add reputation' to those who helped you. Thanks.

+ 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. Help with Pivot Tables to merge two tables
    By scrawl.to.me in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-26-2015, 06:01 AM
  2. Merge tables...
    By Arvex in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-08-2013, 02:57 PM
  3. multiple worksheets, find exceptions and merge into new worksheet
    By letsxcel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-25-2012, 03:55 PM
  4. [SOLVED] Help Please ! Merge two worksheets, then sort, arrange and look for exceptions !
    By desibabuji in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2012, 03:01 AM
  5. [SOLVED] Merge worksheets - exceptions
    By tlozier in forum Excel General
    Replies: 1
    Last Post: 09-16-2005, 09:05 PM
  6. HOW TO MERGE TWO TABLES
    By Bill Vogel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. HOW TO MERGE TWO TABLES
    By Bill Vogel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2005, 12:27 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