Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# What's wrong with this Excel IF function?

Posted on 2006-06-15
Medium Priority
244 Views
=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
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3

LVL 10

Assisted Solution

fostejo earned 600 total points
ID: 16915398

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

LVL 21

Accepted Solution

alainbryden earned 1400 total points
ID: 16915431
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

LVL 21

Expert Comment

ID: 16915461
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

LVL 21

Expert Comment

ID: 16915484
*replace mlsnader with fostejo. I confused the commenter with the questionner.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
###### Suggested Courses
Course of the Month10 days, 19 hours left to enroll