I want to have a threshold value in one cell (`A1`

) and take it as a reference for adding cells.

Suppose I have

```
A1 - 10
A2 - 4
A3 - 2
A4 - 3
A5 - 4
A6 - 6
```

I want to add cells based on A1(Threshold).

If `A1`

is 10, it would add `A2:A5`

, sum = 13

If `A1`

is 9, it would add `A2:A4`

, sum = 9

The SUM formula is

```
=SUM(OFFSET($A$2,0,0,MAX(INDEX((SUBTOTAL(9,OFFSET($A$2, 0,0,ROW(1:99),1))<$A$1)*ROW(1:99),,))+1,1))
```

I have a formula for this first part part...

Then I want the formula to add a percentage of the value in the next cell after the threshold has been reached:

If `A1`

is 10 then cells from `A2:A5`

should be added, plus 50% of `A6`

; sum = 16