Google-sheets – How to sum up values within Google Sheet cells under a specific condition

google sheets

I want to create a Google Sheet that automatically sums up some values. For each green tick in a Present? cell $15 should be added to Total Sum, for each red x nothing should be added. So that all I have to do is fill in presence and the total sum will be calculated.

Date Present? money added Total Sum
1/1/21 + $15 $15
1/2/21 + $0 $15
1/3/21 + $15 $30
1/4/21 + $0 $30
….
2/24/21 + $0 $300 (example)

My idea: I need some if condition like =IF( *Present cell* is ✅, then *money added cell* is $15, if not then *money added cell* is 0) and for Total Sum I just need to build the Sum over the whole money added column to get the interim values up until the present date.

Best Answer

Suppose that Date is column A, that Present? is column B etc.

Cell D2 would be:

=IF(B2 = "✅", C2, 0)

And cell D3 would be:

=IF(B3 = "✅", D2+C3, D2)

Repeat D3 until bottom of dataset.

Example.