Excel – Can I use SUMPRODUCT to ignore empty cells?

My table contains a list of names (some are repeated) in column A, a list of numbers stored in a string in column B, and column C uses a formula to get the first number of the string in column B. It has been create a list of unique names from column A. In column F, they appear several times in the data list and in column G. You then want to retrieve the corresponding data from column C each time they appear in the list to calculate the average cost.

I tried that

=SUMPRODUCT(($A$1:INDEX($A:$A,COUNTA($A:$A))=$E4)*($C$2:INDEX($C:$C,COUNTA($C:$C))))/$F4

The problem I have is that in the list of data some of the cells in column C are empty, so I get a #VALUE Error.

Here's a screenshot of what I'm trying to do:

new edition

Can SUMPRODUCT still be instructed to skip the lines where there is no number data?

Obviously this is just an example and my actual table is a bit more complicated, there are thousands of data lines and the names are repeated many times.