Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50178

VLOOKUP and if duplicate fill 0

$
0
0
Hi, I have been trying to figure out without much luck how to create a vlookup and change the value to 0 if the field looked up is duplicate.

I have 2 columns on sheet 1 and column B is where I am trying to do vlookup. The desired result is to loop thru Item's column on sheet 1 and if a match is found on sheet 2 Items column, populate value from column B on sheet 2 under count column on sheet 1. If sheet 1 Item has a duplicate that has already been populated with a value from sheet 2, append 0 under count on sheet 1 count column. And if the item on sheet 1 is not found under item on sheet 2, populate sheet 1 count value as 0.

Item Count
Cars
Bike
Scooter
Truck
Horse
Horse
Scooter

Sheet 2

Items Count
Cars 10
Bike 15
Scooter 20
Truck 10
Horse 11

Desired output
Item Count
Cars 10
Bike 15
Scooter 20
Truck 10
Horse 11
Horse 0
Scooter 0
SUV 0
Camel 0
Attached Files

Viewing all articles
Browse latest Browse all 50178

Trending Articles