Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to compare two columns in Excel and if match, then copy it

Posted on 2014-03-06
4
419 Views
Last Modified: 2014-03-06
I urgently need a formula for the following problem below. Tried a few suggested solutions online but cannot make it work.

Two Sheets

Sheet1
A | B
Name | Value
Mike | 10
Bob | 3
Chris | 7
John | 3


Sheet2
Name | Email | VALUE
Chris | chris@test.com |
Mike | mike@test.com |


Ok, what I want to achieve is to get the value from sheet 1 into Value in sheet2 of course the name has to match so Chris gets a value of 7, Mike - 10 etc.

I know it requires vlookup and iferror but my excel skills are not good enough to make it work quickly.

Thanks
0
Comment
Question by:m1979
4 Comments
 
LVL 19

Accepted Solution

by:
helpfinder earned 250 total points
ID: 39909593
use =VLOOKUP(A2;Sheet1!$A$1:$B$5;2;FALSE)
check my sample how it looks like in Excel

if you want to include als IFFERROR you can, I added 2 another rows in sheet2 (Kevin and Rosie) to demonstrate. For Kevin there is the same formula (VLOOKUP without IFERROR included) and because Kevin is not in the list in Sheet 1 excel gives back N/A (not available).
If you do not like to see N/A yoi can include IFERROR and tell Excel what do you like instead of N/A - in my example (Rosie row) I put text NOT IN LISt, but you can type what ever you want (text has to be quoted in the formula, so between ""; if you want to have just blank cell, so no N/A or custom text then use just "") - this is in sample1

PS: you may need to replace my semicolons (;) with commas (,) in the formula (it depends on your Regional settings)
sample.xlsx
sample1.xlsx
0
 
LVL 29

Assisted Solution

by:gowflow
gowflow earned 250 total points
ID: 39909619
Put this formula in C2 of Sheet2 and drag down till end of data. For sure if your data is more than the 4 rows that you mentioned you should change the Range to fit the data.

=VLOOKUP(A2,Sheet1!$A$2:$B$13,2,FALSE)

gowflow
vlookup.xlsx
0
 

Author Closing Comment

by:m1979
ID: 39909759
Thx guys, that did the trick. You saved my day
0
 
LVL 8

Expert Comment

by:itjockey
ID: 39909855
Ok try this, it is not required for this issue but in future you may

=IFERROR(VLOOKUP(A2,Sheet1!$A$2:$F$13,MATCH(C1,Sheet1!$A$1:$F$1,0),FALSE),"")

What is addition in formula from above?
A.IFERROR argument which returns to blank I.e. "" when there is error.
B.MATCH function which returns to column number from range, so in future if you add up some more  columns and what to lookup these values then you just have to change header on sheer 2. No need to rewrite whole formula.

Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question