Download the example file from http://www.bluepecantraining.com/portfolio/how-to-handle-duplicate-lookup-problem-in-excel/

One of the shortcomings of Excel’s lookup functions is that you can’t match on duplicate values, instead the functions only match on the first instance of the lookup value it finds in a column or row.

This tutorial will provide you with a solution to this shortcoming. The formula is fairly involved but I will break it down into steps to make it easier to understand.
------------------------