• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

What's wrong with this Excel IF function?

=IF(E13<1001,E13*F5,IF(E13>1000<2001,E13*F6,IF(E13>2000<3001,E13*F7,IF(E13>3000<4001,E13*F8,IF(E13>4001,E13*F9))))) Is it possible to use greater than and less than multiple times in an IF function? Any help is appreciated.
0
mlsnader
Asked:
mlsnader
  • 3
2 Solutions
 
fostejoCommented:
mlsnader,

To my knowledge, you can use constructs like 'E13>1000<2001' (which I presume means "Is E13 >1000 AND < 2001?")

Try using the AND keyword as per:

=IF(E13<1001,E13*F5,IF(AND(E13>1000,E13<2001),E13*F6,IF(AND(E13>2000,E13<3001),E13*F7,IF(AND(E13>3000,E13<4001),E13*F8,IF(E13>4001,E13*F9)))))

cheers
0
 
alainbrydenCommented:
You cannnot say something like E13>1000<2001

The correct way to do this type of thing is to write " E13>1000 AND E13<2001 "

That being said, you don't even need the greater than symbol in the second if statement, because if it has made it that far, then it is a given that E13 is creater than 1000, because you allready proved that it was not less than 1001. You are also missing the else statement for your final if. Your final if should be the else statement.

Therefore, here is the correct formula:

=IF(E13<1001,E13*F5,IF(E13<2001,E13*F6,IF(E13<3001,E13*F7,IF(E13<4001,E13*F8,E13*F9)))))
0
 
alainbrydenCommented:
As mlsnader submitted moments before, but as I said you do not need and statements at all, it's much more efficient without them, and mlsnader's formula is still missing the final else statement, for the last IF() bracket
0
 
alainbrydenCommented:
*replace mlsnader with fostejo. I confused the commenter with the questionner.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now