will this macro help you

Sub test()
Dim j As Long, k As Long, ssum As Double
k = 1
ssum = 0
Do
For j = 1 To Range("A1").End(xlDown).Row
ssum = ssum + Cells(j, 1) * Cells(j, 1).Offset(k, 1)
Next j
k = k + 1
If k > Range("B1").End(xlDown).Row Then Exit Do
Loop
MsgBox ssum
End Sub