I'm making a roommate 'who owes who' money grocery spreadsheet. Basically the part I cant figure out how to do is:

If cell C1 = "Add" then take B1 ($ value) and lookup the name entered in cell A1 and add it to the same name of A1 total sum total in cell D1.

Hopefully I explained this well enough. If not, let me know and I'll elaborate some more. Thanks.