Is it possible to make excel find the total amount of item in the box from the value we input into a cell, added from box #1 first to box #6? This might be confusing so consider the scenario below:

box #: 1, 2, 3, 4, 5, 6
amount of item in box: 1, 2, 4, 8, 12, 16

Would it be possible to make excel add up the sum from box #1-4 simply by typing 4 or box #1-6 by typing 6 and so on?

So this should appear:

value: 1, 4, 6
total amount of item: 1, 15, 43

Basically, if the value is 1 then we find the sum of box #1 so its 1, and if the value is 4 then we find the total amount of item from box #1 to box #4, so 1 + 2 + 4 + 8 = 15, and so on.

How do I do this? What do I write into the excel to make this? Thanks.