I've been working at my job for a couple of weeks now and i've been feeling my way through excel, learning the handy IF function and using it every time I get the chance. I know though, that you cannot nest more than 7 IFs and I used a tip I found on youtube to nest more than 7 ifs by using $ to join groups of 7 ifs. However, I get an error that the formula is invalid,
The problem is unique because it it requires you to observe the last 3 numbers of a sequence and act on the upcoming number based on the combination of the last 3. (numbers can only be -1, 0 and 1). in short, there are 27 different ways i need excel to be able to act based on the last 3 numbers, therefore 27 nested IFs. Can someone help me with what i cannot accomplish?
This is the code i have written:
=IF(AND(X3=-1,X4=-1,X5=-1),Y5*(1+$AA$9*X6),IF(AND(X3=-1,X4=0,X5=-1),Y5*(1+$AB$9*X6),IF(AND(X3=-1,X4=-1,X5=0),Y5*(1+$AC$9*X6),IF(AND(X3=-1,X4=0,X5=0),Y5*(1+$AD$9*X6),IF(AND(X3=-1,X4=1,X5=1),Y5*(1+$AE$9*X6),IF(AND(X3=-1,X4=1,X5=-1),Y5*(1+$AF$9*X6),IF(AND(X3=-1,X4=1,X5=0),Y5*(1+$AG$9*X6),"")))))))&if(and(Y3=-1,Y4=0,Y5=1),Z5*(1+$AH$9*Y6),if(and(Y3=-1,Y4=-1,Y5=1),Z5*(1+$AI$9*Y6),if(and(Y3=0,Y4=-1,Y5=-1),Z5*(1+$AJ$9*Y6),if(and(Y3=0,Y4=0,Y5=-1),Z5*(1+$AK$9*Y6),if(and(Y3=0,Y4=-1,Y5=0),Z5*(1+$AL$9*Y6),if(and(Y3=0,Y4=0,Y5=0),Z5*(1+$AM$9*Y6),if(and(Y3=0,Y4=1,Y5=1),Z5*(1+$AN$9*Y6))))))))&if(and(Y3=0,Y4=1,Y5=-1),Z5*(1+$AO$9*Y6),if(and(Y3=0,Y4=1,Y5=0),Z5*(1+$AP$9*Y6),if(and(Y3=0,Y4=0,Y5=1),Z5*(1+$AQ$9*Y6),if(and(Y3=0,Y4=-1,Y5=1),Z5*(1+$AR$9*Y6),if(and(Y3=1,Y4=-1,Y5=-1),Z5*(1+$AS$9*Y6),if(and(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