Hi all
I am struggling with nested IF statements to get the logic correct for the following problem:
I am trying to calculate forward forecast consumption. There are some rules which need to be observed.
Assume whole week buckets. Sales orders consume forecast for current week and or following week
[TABLE="width: 628"]
<colgroup><col><col><col span="6"></colgroup><tbody>[TR]
[TD][TABLE="width: 628"]
<colgroup><col><col><col span="6"></colgroup><tbody>[TR]
[TD]Sales Orders[/TD]
[TD][/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]120[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Sales F/Cast[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]Expected remaining F/Cast[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[/TR]
</tbody>[/TABLE]
The formula I have used is:
=IF(AND(F18-F19>0,F22=0,G19<(F18-F19)),0,IF(G18>G19,0,IF(AND(G19-G18>0,G18>0),(G18+(F19-F18)),IF(G19-G18=0,0,G19-G18))))<strike></strike>
On the above table, the results are as expected, until I change the cell with value 120 to say - 80. Here the results then change.
If anyone can help me with this, i will be deeply grateful
Thanks in advance
John
[/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
I am struggling with nested IF statements to get the logic correct for the following problem:
I am trying to calculate forward forecast consumption. There are some rules which need to be observed.
Assume whole week buckets. Sales orders consume forecast for current week and or following week
[TABLE="width: 628"]
<colgroup><col><col><col span="6"></colgroup><tbody>[TR]
[TD][TABLE="width: 628"]
<colgroup><col><col><col span="6"></colgroup><tbody>[TR]
[TD]Sales Orders[/TD]
[TD][/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]120[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Sales F/Cast[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[/TR]
[TR]
[TD]Expected remaining F/Cast[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[/TR]
</tbody>[/TABLE]
The formula I have used is:
=IF(AND(F18-F19>0,F22=0,G19<(F18-F19)),0,IF(G18>G19,0,IF(AND(G19-G18>0,G18>0),(G18+(F19-F18)),IF(G19-G18=0,0,G19-G18))))<strike></strike>
On the above table, the results are as expected, until I change the cell with value 120 to say - 80. Here the results then change.
If anyone can help me with this, i will be deeply grateful
Thanks in advance
John
[/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]