if clauses

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » IF clauses

IF clauses

resolvedResolved · Low Priority · Version 2003

Erik has attended:
Excel Introduction course
Excel Intermediate course
Excel Advanced course
Excel VBA Intro Intermediate course

IF clauses

Is it possible to use cascading IF statements?

Edited on Mon 7 Jul 2008, 08:43

RE: IF clauses

Hi Erik, Thank you for your post,

Wow you took the lot in a short period of time, I take my hat off to you, I hope it didnt cause too much brain damage. :)

I have not come across Cascading IF statements, I have seen Cascading data: to do this you would use the Filter option which will do what you want; Available from the Data menu.

Another option would be to use a pivot table although that depends on the layout of your table. I would suggest the filter option using the autofilter to see if that is exactly what you need, there are other options available if you want to automate the process but this is the simplest.

In answer to your question, if however you mean "Nested IF" you should have covered this subject in your Advanced course, but I will go over it again just for others who may be interested.

Excel's IF function provides some simple decision-making capability to a worksheet. The IF function accepts three arguments:

The condition being evaluated (should result in either TRUE or FALSE)
The value to display if the condition is TRUE
The value to display if the condition is FALSE
The formula below, for example, returns 1 if cell A1 contains "A". If cell A1 does not contain "A", the formula returns an empty string.

=IF(A1="A",1,"")

For more decision-making power, you can "nest" IF functions within a formula. In other words, you can use an IF function as the second argument for an IF function. Here's an example:

=IF(A1="A",1,IF(A1="B",2,IF(A1="C",3,"")))

This formula checks cell A1. If it contains "A", the formula returns 1. If it doesn't contain "A", then the second argument is evaluated. The second argument contains another IF function that determines if A1 contains a "B". If so, the formula returns 2; if not, the formula evaluates the IF function contained in the second argument and checks to see if A1 contains "C". If so, it returns 3; otherwise, it returns an empty string.

Excel allows up to seven levels of nested IF functions. The formula below works correctly, but Excel will not allow you to nest the IF functions any deeper than this.

=IF(A1="A",1,IF(A1="B",2,IF(A1="C",3,IF(A1="D",4,
IF(A1="E",5,IF(A1="F",6,IF(A1="G",7,IF(A1="H",8,""))))))))

I hope that answers your question, if so please click the resolved link, regards Pete

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Navigate with keyboard without losing your active cell

If you like using your keyboard to scroll through your excel document, but want to keep your active cell the same, use the scroll lock, and then use your arrow keys to navigate around the document.

View all Excel hints and tips


Server loaded in 0.08 secs.