A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Use this formula:
=IF(B5<>"",SUMPRODUCT(--(B5:Q5=B4:Q4)),0)
It first checks whether B5 is not empty. If B5 contains a value, SUMPRODUCT compares each cell in B5:Q5 with the corresponding cell in B4:Q4 and counts the matches. If B5 is empty, it returns 0 and does not perform the count.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin