0

In the green table we fill in certain columns manually. Some columns (Fat, Protein) we want to get filled in from the blue table with PowerQuery. All entries have a unique ID, which match between the green and blue table.

The green table has formulas (ID) (is it ok with formulas in the table?)

Both tables grow during the day.

How can I get the missing values in the green table in column "Fat" and "Protein" from the blue table with PowerQuery? I know only the basics in PowerQuery.

enter image description here

enter image description here

3
  • You can use a formula combining INDEX and MATCH functions to extract Fat and Protein. Or XLOOKUP if you have Excel 365. Commented Aug 29, 2022 at 5:26
  • @ReddyLutonadio That would be easy but a lot of lookup formulas. This would be my last choice for different reasons. Is it possible with PowerQuery, not to complicated? Otherwise I might write a macro instead.
    – WeAreOne
    Commented Aug 29, 2022 at 5:59
  • You can't enter data into the result table of a query in a reliable way. When the query refreshes, there's a risk the data you've entered will be in the wrong order, or overwritten. Commented Aug 29, 2022 at 13:32

1 Answer 1

0

You first need to build a query to read in the blue table. Set that to Load To / Only create connection - so it doesnt create a new table.

Then back in your main query, add a Merge Queries step. Select the 2 id columns as the matching columns. Next expand the column added by the Merge Queries step to add the Fat and Protein columns to your query - there will be an Expand/Aggregate button in it's column header.

You might also want to add Conditional Columns to choose either your original columns or the ones from the Merge Queries, then remove the original columns.

2
  • I tried this already. So I ended up with 2 extra columns, but I don't want to delete my original columns, I just want to add values in the missing cells. Is that possible with PowerQuery?
    – WeAreOne
    Commented Aug 30, 2022 at 3:05
  • Possible with custom code, but not the way to use the tool. Just rename columns and remove your original columns from the query.
    – Mike Honey
    Commented Sep 1, 2022 at 2:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .