ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to compare two columns on two sheets and copy associated data from one sheet to the other? (https://www.excelbanter.com/excel-programming/391859-how-compare-two-columns-two-sheets-copy-associated-data-one-sheet-other.html)

[email protected]

how to compare two columns on two sheets and copy associated data from one sheet to the other?
 
I have two sheets of data and Column A on both sheets has the same
type data (numbers) some numbers are the same on both sheets in Column
A, some are different, the numbers are not in the same order on both
sheets. Sheet1 also has a value in Columns Q & R in the same row that
is associated with Column A. I want to copy the value in Column Q&R
to Sheet 2 if the same number in column A exists on sheet 2.
I have attempted VLOOKUP function, but have not been successful. Can
anyone assist me?

Sheet 1
Column A Column Q Column R
row1 5-123 test_01 details_and_code
row2 2-657 test_06 code
row3 5-1245 test_08 writing


Sheet 2
Column A Column Q Column R
row1 5-123
row2 4-4456
row3 2-657


Tom Ogilvy

how to compare two columns on two sheets and copy associated data
 
in B2 of Sheet2
=if(iserror(match(A2,Sheet1!A:A,0)),"",Index(Sheet 1!Q:Q,Match(A2,Sheet1!A:A,0),1))

In C2
=if(iserror(match(A2,Sheet1!A:A,0)),"",Index(Sheet 1!R:R,Match(A2,Sheet1!A:A,0),1))

Drag fill down.

If you wanted them concatenated

=if(iserror(match(A2,Sheet1!A:A,0)),"",Index(Sheet 1!Q:Q,Match(A2,Sheet1!A:A,0),1)&Index(Sheet1!R:R,M atch(A2,Sheet1!A:A,0),1))

--
Regards,
Tom Ogilvy

" wrote:

I have two sheets of data and Column A on both sheets has the same
type data (numbers) some numbers are the same on both sheets in Column
A, some are different, the numbers are not in the same order on both
sheets. Sheet1 also has a value in Columns Q & R in the same row that
is associated with Column A. I want to copy the value in Column Q&R
to Sheet 2 if the same number in column A exists on sheet 2.
I have attempted VLOOKUP function, but have not been successful. Can
anyone assist me?

Sheet 1
Column A Column Q Column R
row1 5-123 test_01 details_and_code
row2 2-657 test_06 code
row3 5-1245 test_08 writing


Sheet 2
Column A Column Q Column R
row1 5-123
row2 4-4456
row3 2-657




All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com