Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare Two Columns
Hi All,
I have 4 data columns. Column A has 150 data cells, Column B, C and D has 450 data cells. I would like to compare only Column A to Column B and if there is a match, put the matching results in Column F - Column G - Column H - Column I. Situation: A B C D 1 3 x y 2 2 x y 3 0 x y 4 1 x y Results needed: F G H I 1 1 x y 2 2 x y 3 3 x y Any help would be great! Thanks in Advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare Two Columns
ng6971 wrote:
Hi All, I have 4 data columns. Column A has 150 data cells, Column B, C and D has 450 data cells. I would like to compare only Column A to Column B and if there is a match, put the matching results in Column F - Column G - Column H - Column I. Situation: A B C D 1 3 x y 2 2 x y 3 0 x y 4 1 x y Results needed: F G H I 1 1 x y 2 2 x y 3 3 x y Any help would be great! Thanks in Advance. Assuming values in A will have at most one match in B this boils down to a VLOOKUP. Do you need to use VBA? If not these worksheet functions will get you most* of the way the F1 =A1 G1 =VLOOKUP(F1,$B$1:$D$450,1,FALSE) H1 =VLOOKUP(F1,$B$1:$D$450,2,FALSE) I1 =VLOOKUP(F1,$B$1:$D$450,3,FALSE) *there may be values in A that have no match in B and will return #N/A. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare Two Columns
Hi Smartin,
It Works perfectly. Need a VBA code also for entire columns not the range as mentioned eariler. Thanks & Warm Regards NG "smartin" wrote: ng6971 wrote: Hi All, I have 4 data columns. Column A has 150 data cells, Column B, C and D has 450 data cells. I would like to compare only Column A to Column B and if there is a match, put the matching results in Column F - Column G - Column H - Column I. Situation: A B C D 1 3 x y 2 2 x y 3 0 x y 4 1 x y Results needed: F G H I 1 1 x y 2 2 x y 3 3 x y Any help would be great! Thanks in Advance. Assuming values in A will have at most one match in B this boils down to a VLOOKUP. Do you need to use VBA? If not these worksheet functions will get you most* of the way the F1 =A1 G1 =VLOOKUP(F1,$B$1:$D$450,1,FALSE) H1 =VLOOKUP(F1,$B$1:$D$450,2,FALSE) I1 =VLOOKUP(F1,$B$1:$D$450,3,FALSE) *there may be values in A that have no match in B and will return #N/A. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare Two Columns
I'm a little confused about the requirement. What do you expect a VBA
solution to do that the worksheet function does not do? Do you want to avoid placing a function in the cells altogether (and which cells are they? or is the code supposed to figure that out? and what should the trigger be to run the code?) Or instead do you want a custom function called from the worksheet? Or ... ? ng6971 wrote: Hi Smartin, It Works perfectly. Need a VBA code also for entire columns not the range as mentioned eariler. Thanks & Warm Regards NG "smartin" wrote: ng6971 wrote: Hi All, I have 4 data columns. Column A has 150 data cells, Column B, C and D has 450 data cells. I would like to compare only Column A to Column B and if there is a match, put the matching results in Column F - Column G - Column H - Column I. Situation: A B C D 1 3 x y 2 2 x y 3 0 x y 4 1 x y Results needed: F G H I 1 1 x y 2 2 x y 3 3 x y Any help would be great! Thanks in Advance. Assuming values in A will have at most one match in B this boils down to a VLOOKUP. Do you need to use VBA? If not these worksheet functions will get you most* of the way the F1 =A1 G1 =VLOOKUP(F1,$B$1:$D$450,1,FALSE) H1 =VLOOKUP(F1,$B$1:$D$450,2,FALSE) I1 =VLOOKUP(F1,$B$1:$D$450,3,FALSE) *there may be values in A that have no match in B and will return #N/A. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how can I compare two columns | Excel Worksheet Functions | |||
Compare two columns | Excel Discussion (Misc queries) | |||
Compare two columns | Excel Discussion (Misc queries) | |||
COMPARE 2 COLUMNS | Excel Discussion (Misc queries) | |||
Compare columns of value | Excel Programming |