As the title says, I want to subtract n from min value first and then the remainder of n from the max value. I thought I had it cracked until one of the values exceeds n.
My formula is =IF(C4=D4,C4-(B/2),IF(C4<D4,MIN(SUM(C4:D4)-B4,0),MAX(SUM(C4:D4)-B4,0))) for bot AA and BB.
<d4,min(sum(c4:d4)-b4,),max(sum(c4:d4)-b4,0)))
The expected result in E4 (AA) should be 100 and F4 (BB) should be 69 but as you can see it falls over. Can anyone make a suggestion?
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD](A1)[/TD]
[TD](B1) n
[/TD]
[TD](C1) a
[/TD]
[TD](D1) b
[/TD]
[TD](E1) aa
[/TD]
[TD](F1) bb
[/TD]
[/TR]
[TR]
[TD](A2)
[/TD]
[TD]30
[/TD]
[TD]20
[/TD]
[TD]25
[/TD]
[TD]0
[/TD]
[TD]15
[/TD]
[/TR]
[TR]
[TD](A3
[/TD]
[TD]30
[/TD]
[TD]17
[/TD]
[TD]14
[/TD]
[TD]1
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD](A4)
[/TD]
[TD]30
[/TD]
[TD]100
[/TD]
[TD]99
[/TD]
[TD]169 (Exp 100)
[/TD]
[TD]0 (Exp 69)
[/TD]
[/TR]
</tbody>[/TABLE]
</d4,min(sum(c4:d4)-b4,),max(sum(c4:d4)-b4,0)))
My formula is =IF(C4=D4,C4-(B/2),IF(C4<D4,MIN(SUM(C4:D4)-B4,0),MAX(SUM(C4:D4)-B4,0))) for bot AA and BB.
<d4,min(sum(c4:d4)-b4,),max(sum(c4:d4)-b4,0)))
The expected result in E4 (AA) should be 100 and F4 (BB) should be 69 but as you can see it falls over. Can anyone make a suggestion?
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD](A1)[/TD]
[TD](B1) n
[/TD]
[TD](C1) a
[/TD]
[TD](D1) b
[/TD]
[TD](E1) aa
[/TD]
[TD](F1) bb
[/TD]
[/TR]
[TR]
[TD](A2)
[/TD]
[TD]30
[/TD]
[TD]20
[/TD]
[TD]25
[/TD]
[TD]0
[/TD]
[TD]15
[/TD]
[/TR]
[TR]
[TD](A3
[/TD]
[TD]30
[/TD]
[TD]17
[/TD]
[TD]14
[/TD]
[TD]1
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD](A4)
[/TD]
[TD]30
[/TD]
[TD]100
[/TD]
[TD]99
[/TD]
[TD]169 (Exp 100)
[/TD]
[TD]0 (Exp 69)
[/TD]
[/TR]
</tbody>[/TABLE]
</d4,min(sum(c4:d4)-b4,),max(sum(c4:d4)-b4,0)))