Forum Discussion

Marcus Dix's avatar
Marcus Dix
Copper Contributor
Jul 15, 2018

Nested IF FUNCTION

Hi Everyone,

 

I hope you are all well.

 

I was wondering if someone would be able to help me fix my nested IF formula. So far I have had as errors ("this formula is missing an opening or closing parentheses" and "this formula contains too many functions").

 

=IF(Purchaseprice<=40000,K46, IF(AND(Purchaseprice>=40001,Purchaseprice<=52000,K47,IF(AND(Purchaseprice>=52001,Purchaseprice<=68000,K48, IF(AND(Purchaseprice>=68001,Purchaseprice<=88000,K49,IF(AND(Purchaseprice>=88001,Purchaseprice<=120000,K50,IF(AND(Purchaseprice>=120001,Purchaseprice<=160000,K51,IF(AND(Purchaseprice>=160001,Purchaseprice<=320000,K52,0)))))))))))))

 

Any idea what the issue is?

 

Thanks guys!

 

Marcus

2 Replies

  • Haytham Amairah's avatar
    Haytham Amairah
    Silver Contributor

    Hi Marcus,

     

    You have to close the parenthesis of each AND function in the formula after the second logical test, not at the end of the formula!

     

    This is the fix:

    =IF(Purchaseprice<=40000,K46,
     IF(AND(Purchaseprice>=40001,Purchaseprice<=52000),K47,
     IF(AND(Purchaseprice>=52001,Purchaseprice<=68000),K48,
     IF(AND(Purchaseprice>=68001,Purchaseprice<=88000),K49,
     IF(AND(Purchaseprice>=88001,Purchaseprice<=120000),K50,
     IF(AND(Purchaseprice>=120001,Purchaseprice<=160000),K51,
     IF(AND(Purchaseprice>=160001,Purchaseprice<=320000),K52,0)))))))

     

    Regards

Resources