Forum Discussion

Matthew Plant's avatar
Matthew Plant
Copper Contributor
Sep 27, 2018
Solved

Help with Excel

Hi, I have a problem which hopefully you can help with, I have a column with customer names and their sales for 2016 and a column with customer names and their sales for 2017. Some names appear in one column and not the other (like below)

Customer2016 Customer2017
a700 b900
b650 h400
c625 e375
d500 a100
e400 i50
f375 j25
g100   
h25   


How do I merge the two columns of customer names together (like below) but keep their respective 2016 and 2017 sales in separate columns?

Customer20162017
a700100
b650900
c625 
d500 
e400375
f375 
g100 
h25400
i 50
j 25

 

Thanks for any help you can give.

  • Detlef_Lewin's avatar
    Detlef_Lewin
    Sep 28, 2018

    Click on "Show Queries" on the Data tab in the ribbon. That will open the "Queries & Connections" pane.

    This workbook has three queries.

    Double-click on one of the queries to get to the query editor.

    Open the navigation pane on left side to see all the queries.

    "tbl_2016" and "tbl_2017" just load both tables into PQ. They are loaded as connection only.

    The last query is build via the UI. Both tables are appended. The columns "Year" and "Sales" are unpivoted. Then the table is pivoted with column "Year".

    The query "Append1" is loaded as a table to the worksheet.

     

    • Matthew Plant's avatar
      Matthew Plant
      Copper Contributor

      Thanks Detlef,

       

      I'm new to excel, please can you advise how to use the power query solution to produce the combined result from the original two sets of data?

       

      Thanks.

      • Detlef_Lewin's avatar
        Detlef_Lewin
        Silver Contributor

        Click on "Show Queries" on the Data tab in the ribbon. That will open the "Queries & Connections" pane.

        This workbook has three queries.

        Double-click on one of the queries to get to the query editor.

        Open the navigation pane on left side to see all the queries.

        "tbl_2016" and "tbl_2017" just load both tables into PQ. They are loaded as connection only.

        The last query is build via the UI. Both tables are appended. The columns "Year" and "Sales" are unpivoted. Then the table is pivoted with column "Year".

        The query "Append1" is loaded as a table to the worksheet.

         

Resources