If you are dealing with numbers, you do not need that stupid if function.
Simply doing something like this: =(A<N)*a+(A>=N)*(A<M)*b+(A>=M)*c, the idea here will also solve your another question above.
If you do not understand this and try to find the deeper reason, transfer your CFC money to me first.