I have two sheets:

Sheet 1
Col A
A
B
C
D

Sheet 2
Col A Col B
A XX
B YY
AXX
A Z
D D
DD

I want to count the number of unique occurance of value in Col B in Sheet 2 as per value in Col A in sheet 1 and Sheet2.


My output result should be like following:


Result
Col A Count of col B value in Sheet 2
A 2
B 1
C 0
D 1






Thanks for help.