0

This probably has a very simple solution, I just don't know what search terms to use.

I have several different Excel workbooks. They all have a sheet with the same information, some of which is the same, and some of which is only non-null in one of the workbooks. Something like this:

Workbook 1:

ID Name Value
1 Foo
2 Bar 2
3 Baz

Workbook 2:

ID Name Value
1 Foo 4
2 Bar
3 Baz 9

Just with a lot more workbooks. However, the "Value" field is only populated in one workbook for each row. In all the rest of the workbooks, it's null.

Now I need to merge them into this:

ID Name Value
1 Foo 4
2 Bar 2
3 Baz 9

I have created data queries with each separate workbook as a source, based on the ID field, but when I merge the queries, it only takes the values from the first workbook. The rest are null.

How do I merge the "Value" columns, by keeping all the non-null values from all workbooks/queries?

3
  • 1
    yes lots of ways to do it. Assuming no data integrity issues, and depending on the need for repeatability 1) just copy/paste, then filter/delete all null values, 2) write a formula, 3) use power Query, 4) use VBA. 2-4 are basically automation of 1)...
    – gns100
    Commented Sep 3, 2021 at 16:16
  • When working with multiple files I'd usually recommend vba, references are possible as well if your file location, filename and sheet names are not changing.
    – Jason K.
    Commented Sep 5, 2021 at 5:50
  • import several Excel files located in the same folder with PowerQuery.
    – visu-l
    Commented Sep 7, 2021 at 19:37

1 Answer 1

0

Please try this:

=IF(ISBLANK(VLOOKUP(B2,Sheet1!$B$2:$C$4,2,FALSE)),VLOOKUP(B2,Sheet2!$B$2:$C$4,2,FALSE),VLOOKUP(B2,Sheet1!$B$2:$C$4,2,FALSE))

enter image description here

You must log in to answer this question.

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