ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Comparison Function (https://www.excelbanter.com/excel-worksheet-functions/93845-comparison-function.html)

DifficultyInExcel-ing

Comparison Function
 
I want to compare data on one sheet with data on another sheet (within the
same file) and then populate cells with data from that other sheet. For
example:

Column B (Sheet 1) has data that may have duplicate data from Column A
(Sheet 2). If so, I want to copy the data from Column B (Sheet 2) to Column
E (Sheet 1).

Can someone help me figure out which function(s) to use and how to formulate
the logical sequence?

Thanks!

bpeltzer

Comparison Function
 
The basic test to pull data from one table based on a matching value earlier
in the same row is a vlookup. To produce a null result when there's no
match, you'd embed that inside an if function. And the formula will always
go in the cell where the result should appear.
So enter a formula in sheet 1, cell E2:
=if(isna(vlookup(b2,Sheet2!A:B,2,0)),"",vlookup(b2 ,Sheet2!A:B,2,0))
You could copy that formula down to as many rows of column E as you need.
(You might first enter just the vlookup part: =vlookup(b2,Sheet2!A:B,2,0)
then Insert Function and see what the dialog tells you about the arguments
of the vlookup function).

"DifficultyInExcel-ing" wrote:

I want to compare data on one sheet with data on another sheet (within the
same file) and then populate cells with data from that other sheet. For
example:

Column B (Sheet 1) has data that may have duplicate data from Column A
(Sheet 2). If so, I want to copy the data from Column B (Sheet 2) to Column
E (Sheet 1).

Can someone help me figure out which function(s) to use and how to formulate
the logical sequence?

Thanks!


DifficultyInExcel-ing

Comparison Function
 
Thanks so much for your help on this. It's really a time saver! --

"bpeltzer" wrote:

The basic test to pull data from one table based on a matching value earlier
in the same row is a vlookup. To produce a null result when there's no
match, you'd embed that inside an if function. And the formula will always
go in the cell where the result should appear.
So enter a formula in sheet 1, cell E2:
=if(isna(vlookup(b2,Sheet2!A:B,2,0)),"",vlookup(b2 ,Sheet2!A:B,2,0))
You could copy that formula down to as many rows of column E as you need.
(You might first enter just the vlookup part: =vlookup(b2,Sheet2!A:B,2,0)
then Insert Function and see what the dialog tells you about the arguments
of the vlookup function).

"DifficultyInExcel-ing" wrote:

I want to compare data on one sheet with data on another sheet (within the
same file) and then populate cells with data from that other sheet. For
example:

Column B (Sheet 1) has data that may have duplicate data from Column A
(Sheet 2). If so, I want to copy the data from Column B (Sheet 2) to Column
E (Sheet 1).

Can someone help me figure out which function(s) to use and how to formulate
the logical sequence?

Thanks!



All times are GMT +1. The time now is 04:55 AM.

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