Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I compare two columns snwwlf Excel Worksheet Functions 1 November 7th 08 12:31 AM
Compare two columns pm Excel Discussion (Misc queries) 7 July 3rd 08 09:59 PM
Compare two columns Jennifer Hammonds Excel Discussion (Misc queries) 2 April 25th 07 05:54 PM
COMPARE 2 COLUMNS CB Excel Discussion (Misc queries) 0 June 7th 06 08:00 PM
Compare columns of value fl Excel Programming 1 August 4th 04 07:46 PM


All times are GMT +1. The time now is 02:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"