I need to switch between 4 formulas based on 4 criteria. The criteria are in two fields (2 criteria in each). I handle it using the IF statement, but the whole formula is so cumbersome:
So basically, it goes as follows:
IF it's "IS" and "Direct", the values are taken as they are
IF it's "IS" and "Reverse", the values change the sign (from + to - or vice versa)
IF it's "BS" and "Direct", it is current value minus previous value
IF it's "BS" and "Reverse", it's previous value minus current value
Don't mind the INDEX MATCH construction, I am going to change it to a different formula. It's just so difficult to change the formula and to understand it after a few months from the time it's created so I wonder if it's possible to use some logical function instead of the IF expression. Unfortunately I cannot upload a spreadsheet example due to restrictions.
Excel Formula:
=IF($D5="IS",IF($E5="Direct",INDEX(FS!$1:$1048576,MATCH($A5,FS!$B:$B,0),MATCH(G$1,FS!$1:$1,0)),-INDEX(FS!$1:$1048576,MATCH($A5,FS!$B:$B,0),MATCH(G$1,FS!$1:$1,0))),IF($D5="BS",IF($E5="Direct",INDEX(FS!$1:$1048576,MATCH($A5,FS!$B:$B,0),MATCH(G$1,FS!$1:$1,0))-OFFSET(INDEX(FS!$1:$1048576,MATCH($A5,FS!$B:$B,0),MATCH(G$1,FS!$1:$1,0)),,-1),OFFSET(INDEX(FS!$1:$1048576,MATCH($A5,FS!$B:$B,0),MATCH(G$1,FS!$1:$1,0)),,-1)-INDEX(FS!$1:$1048576,MATCH($A5,FS!$B:$B,0),MATCH(G$1,FS!$1:$1,0)))))
So basically, it goes as follows:
IF it's "IS" and "Direct", the values are taken as they are
IF it's "IS" and "Reverse", the values change the sign (from + to - or vice versa)
IF it's "BS" and "Direct", it is current value minus previous value
IF it's "BS" and "Reverse", it's previous value minus current value
Don't mind the INDEX MATCH construction, I am going to change it to a different formula. It's just so difficult to change the formula and to understand it after a few months from the time it's created so I wonder if it's possible to use some logical function instead of the IF expression. Unfortunately I cannot upload a spreadsheet example due to restrictions.