Try this:
=IF((IFERROR(INDEX('Data Entry'!$K$2:$K$10000,MIN(IF((MONTH('Data Entry'!$C$2:$C$10000)=MONTH(H$6))*(YEAR('Data Entry'!$C$2:$C$10000)=YEAR(H$6))*('Data Entry'!$G$2:$G$10000=$C50),ROW('Data Entry'!$C$2:$C$10000),""))-ROW('Data Entry'!$C$2)+1),"0"))=0,$B1,IFERROR(INDEX('Data Entry'!$K$2:$K$10000,MIN(IF((MONTH('Data Entry'!$C$2:$C$10000)=MONTH(H$6))*(YEAR('Data Entry'!$C$2:$C$10000)=YEAR(H$6))*('Data Entry'!$G$2:$G$10000=$C50),ROW('Data Entry'!$C$2:$C$10000),""))-ROW('Data Entry'!$C$2)+1),"0"))