You are here:

Excel/Replacing in Excel


Dear all.
We work in a company who distributes books monthly to bookstores
we have an excel sheet containing our customers name and their corresponding codes.(see image 1)

and each month,we receive an excel report with the sales of these bookstores(Sales VS Customer codes “NOT THEIR NAMES”).(see image 2)

I want to convert these 2 sheets into one sheet containing the customers names(NOT THEIR CODES) Vs their sales directly.

How can I do that


With no other guidance, I assume, in the third sheet, you want to see an image of sheet2 with the codes replaced by the names.  

Assume the first sheet you show is named sheet1
Assume the second sheet you show is named sheet2

in Sheet3

A2:  =vlookup(Sheet2!$A2,Sheet1!$A:$B,2,False)
B2:  =Sheet2!$B2

select A2:B2 and drag fill down the column until you run out of values.

Note that vlookup returns a #N/A error when it does not find the code it is looking for.  If you believe the code is there, then make sure that the codes are stored the same way in each sheet.  Either they are stored as numbers or they are stored as strings.  for example, 123 <> "123".  The number 123 does not match the text string 123.

Tom Ogilvy

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2017 All rights reserved.