How to paste sparse columns so they line up with existing data?

Posted on

QUESTION :

So, I have a spreadsheet with about 5000 rows.
Each of these rows has a unique number in column A, followed by some data in column B:

| A     | B          |
|-------|------------|
| 5142  | Test       |
| 5348  | Some stuff |
| 32665 | More stuff |
| 74568 | More stuff |

In another spreadsheet, I have some different data, for SOME of the IDs in my first spreadsheet, but not all of them:

| A     | B         |
|-------|-----------|
| 5348  | 1/1/2017  |
| 74568 | 6/25/2018 |

What I want to do is copy these columns from the second spreadsheet into the first spreadsheet, but I need the rows to spread out to paste into the corresponding rows from spreadsheet 1, so what I end up with is this:

| A     | B          | C     | D         |
|-------|------------|-------|-----------|
| 5142  | Test       |       |           |
| 5348  | Some stuff | 5348  | 1/1/2017  |
| 32665 | More stuff |       |           |
| 74568 | More stuff | 74568 | 6/25/2018 |

Any idea how I can accomplish this?

ANSWER :

set cell C to:

=vlookup(A1,sheet2!A:B,1,FALSE)

and cell D to:

=vlookup(A1,sheet2!A:B,2,FALSE)

Where your data in sheet 2 is in columns A and B.

Leave a Reply

Your email address will not be published. Required fields are marked *