Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compare two columns and copy data if values are the same.


I've tried figuring this out with formulas but I think I need a vba
solution.
I've got a column with values in column A in sheet 1 and I've got a
column of values in column G of sheet 2. Every value in column G sheet2
is one of the values from column A sheet 1. What I need is something
that will compare G to the whole column of A and then copy the value
from cell B from sheet 1 to Column H in sheet 2.
Example:

Sheet 1 Sheet 2
A B G H
1 1 1
2 8 1
3 4 2
4 6 4
5 3 4
4
5

Would become

Sheet 2
G H
1 1
1 1
2 8
4 6
4 6
4 6
5 3

Any help would be appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compare two columns and copy data if values are the same.


Ok the advertisement messed up the layout.
Sheet 1 Sheet 2
A B G H
1 1 1
2 8 1
3 4 2
4 6 4
5 3 5
Would become
Sheet 2
G H
1 1
1 1
2 8
4 6
5 3


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Compare two columns and copy data if values are the same.

It looks like you could use =vlookup() or =index(match())
=vlookup(g1,sheet1!a:b,2,false)

Debra Dalgleish has lots of notes:
http://www.contextures.com/xlFunctions02.html (for =vlookup())
and
http://www.contextures.com/xlFunctions03.html (for =index(match()))
and
http://contextures.com/xlFunctions02.html#Trouble

Akhorahil wrote:

Ok the advertisement messed up the layout.
Sheet 1 Sheet 2
A B G H
1 1 1
2 8 1
3 4 2
4 6 4
5 3 5
Would become
Sheet 2
G H
1 1
1 1
2 8
4 6
5 3


--

Dave Peterson
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
Compare data in 2 columns for unique values Steve C[_2_] Excel Discussion (Misc queries) 2 November 29th 07 04:26 PM
how to compare two columns on two sheets and copy associated data from one sheet to the other? [email protected] Excel Programming 1 June 22nd 07 04:12 PM
how to compare two columns on two sheets and copy associated data from one sheet to the other? [email protected] Excel Worksheet Functions 2 June 22nd 07 03:40 PM
Compare Columns and Copy Data [email protected] Excel Programming 1 August 18th 06 02:03 PM
Excel Compare values in columns & display missing values in a new cpetta Excel Discussion (Misc queries) 1 April 2nd 05 05:51 AM


All times are GMT +1. The time now is 01:53 PM.

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

About Us

"It's about Microsoft Excel"