Images are of very limited use - post a sample file.

Re: your sample - why is D2 1 and D5 3 given B & C are the same for both rows ?