Forum Discussion
Manually adding column to Table loaded from Query then refresh
- 6 years ago
You cannot keep an Excel column in sync with a Power Query column. If you are using a fomula that does the same thing to all rows ([Sales] * 1.05%) for example, that will work, but you are trying to keep individual comments tied to specific rows. You need to use Power Query to keep them in sync. See this file for what I've done, explained below.
- Create a new table in Excel that has your comments. It also must have the column(s) that will be a unique link to the specific row you want I've used a combination of the Account Number and Journal Entry based on your screenshots.
- Add a Comment field to your Comment table and make your comments.
- Select your Comment table and load it to Power Query.
- Click the first query in Power Query and on the Home ribbon, Merge as new.
- Select your comment table.
- Make sure the fields line up as shown here. You do this by selecting first Account Number, then Journal Entry. PQ will add the little 1/2. (You don't worry about this if you have one unique column, but here we need two columns for uniqueness)
- Once done, Expand the Comments table, and uncheck everything except the Comment field itself.
- You can see how this looks in Power Query's Dependency View in the View Tab.
- Exit Power Query. make sure the first two tables are not loaded, but load the new merged table.
- It will look like this;
Note: if your original table is comeing from Power Query, and yours may be, then modify my steps as follows:
#4 - In the query you are using to put your JEs to the workbook, just Merge, not Merge as New, with the comment field.
#8 - Your dependency view will look a little different.
#9 - Make sure your comment table is not loaded. But your original query is loaded and will now bring the comment field in.
Add comments as desired, and Refresh the queries.
Note: You could do this with XLOOKUP() as well, but I don't like mixing query work with VLOOKUP/XLOOKUP/INDEX-MATCH stuff as it will cause you problems down the line as you try to integrate more in, or you decided to move this to the Data Model or Power BI where no Excel functions work. Once in Power Query, stay in Power Query. 👍
You cannot keep an Excel column in sync with a Power Query column. If you are using a fomula that does the same thing to all rows ([Sales] * 1.05%) for example, that will work, but you are trying to keep individual comments tied to specific rows. You need to use Power Query to keep them in sync. See this file for what I've done, explained below.
- Create a new table in Excel that has your comments. It also must have the column(s) that will be a unique link to the specific row you want I've used a combination of the Account Number and Journal Entry based on your screenshots.
- Add a Comment field to your Comment table and make your comments.
- Select your Comment table and load it to Power Query.
- Click the first query in Power Query and on the Home ribbon, Merge as new.
- Select your comment table.
- Make sure the fields line up as shown here. You do this by selecting first Account Number, then Journal Entry. PQ will add the little 1/2. (You don't worry about this if you have one unique column, but here we need two columns for uniqueness)
- Once done, Expand the Comments table, and uncheck everything except the Comment field itself.
- You can see how this looks in Power Query's Dependency View in the View Tab.
- Exit Power Query. make sure the first two tables are not loaded, but load the new merged table.
- It will look like this;
Note: if your original table is comeing from Power Query, and yours may be, then modify my steps as follows:
#4 - In the query you are using to put your JEs to the workbook, just Merge, not Merge as New, with the comment field.
#8 - Your dependency view will look a little different.
#9 - Make sure your comment table is not loaded. But your original query is loaded and will now bring the comment field in.
Add comments as desired, and Refresh the queries.
Note: You could do this with XLOOKUP() as well, but I don't like mixing query work with VLOOKUP/XLOOKUP/INDEX-MATCH stuff as it will cause you problems down the line as you try to integrate more in, or you decided to move this to the Data Model or Power BI where no Excel functions work. Once in Power Query, stay in Power Query. 👍