SUMPRODUCT is a little unusual in that it works like a loop. Most Excel functions, like SUM, won't do this. It is perfect for weighted averages.

SUMPRODUCT($A$1:$A$5,6-$B$1:$B$5)

This means you have defined two arrays. The first array is A1, A2, A3, A4, A5. The second array is 6-B1, 6-B2, and so forth. Then it does a vector multiplication on them, and effectively does this:

A1*(6-B1) + A2*(6-B2) +A3*(6-B3) +A4*(6-B4) +A5*(6-B5)

There are creative ways to solve all kinds of looping problems with SUMPRODUCT.

A similar way to do this is with an array formula, which has more flexibility.