I would like to write the following if statement
=IF(B1=D1,C1,0)+IF(B1=D2,C2,0)+IF(B1=D3,C3,0)+...

Essentially I want to match a text value in column D with the first one in column B and record the associated value of C. I need to do this for over a thousand values in column B.

I am not too familiar with these formulas or codes but essentially what I would like to do is use the statement =IF(B$1=D1,C1,0) and sum it for the entire column. I would then like to record that sum and put it in the same place as the original, say G1.