Count Records Between Specific Select Field

Hello there!

I have following problem: My database primary field is a date. I do entrys just like in a diary. For each entry, I can choose the select field 1 or select field 2 as type. Now I want to count all input fields in concurrence between select field 1 and select field 2 and display it in a third field.

So for example:
Name / Input Field / Accumulated
Select field 1 - empty - empty
Select field 2 - 100 - 100
Select field 2 - 150 - 250
Select field 2 - 125 - 375
Select field 2 - 25 - 400
Select field 2 - 100 - 500
Select field 1 - empty - empty
Select field 2 - 50 - 50
Select field 2 - 100 - 150

I know want a third field that displays the sum or accumulated value of input field between the two select field 1. The table is sorted by the date field.

Is this in any way possible?

Thanks!