Reputation: 27
I'm looking for a formula on excel to do the following.
If a value on a spreadsheet is a match to a value on another spreadsheet:
Then paste the cell next to the match from the first spreadsheet into the cell next to the match on the other spreadsheet.
This is for a stock spreadsheet from my supplier, it is 2 columns, 1 with an item code and the 2nd with a quantity in stock.
I need to check if the code exists on my other spreadsheet and if so paste the stock quantity from the shop spreadsheet in the cell next to the match on my spreadsheet.
Upvotes: 1
Views: 28258
Reputation: 33738
The LOOKUP and VLOOKUP functions seem to be what you need here.
Simply comparing one cell to another as other answers indicate will require both data sets to be in the same order and without gaps. LOOKUP and VLOOKUP remove this restriction.
Upvotes: 3
Reputation: 3111
Assume two worksheets W1 and W2. W1 and W2 both have columns A. You want to check, for example A1 on W1. If it matches A1 on W2, then you paste A1 from W1 to B1 on W2. Put this code in B1 on W2:
=IF(W1!A1=W2!A1,W1!A1,"")
Upvotes: 2