Hi Basavaraj,
Try below formula in C4 and copy down:
=SUM((IF(FREQUENCY(IF((A4='Master Sheet'!$B$2:$B$605)+(A4='Master Sheet'!$C$2:$C$605),MATCH('Master Sheet'!$G$2:$G$605,'Master Sheet'!$G$2:$G$605,0)),IF((A4='Master Sheet'!$B$2:$B$605)+(A4='Master Sheet'!$C$2:$C$605),MATCH('Master Sheet'!$G$2:$G$605,'Master Sheet'!$G$2:$G$605,0))),1,0)))
Confirm with Ctrl+Shift+Enter. Note in some cells you have not given the correct result.
Regards,