98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Nested IF statements
Nested IF statements
Resolved · Medium Priority · Version 2010
Calum has attended:
Excel VBA Intermediate course
Nested IF statements
Hi Jens,
Hope you are well.
I have a query regarding nested IF statements in Excel and how to construct them. However I don't know where to begin or how to construct the layers, so to speak.
I posted my query on a public forum and was advised that it was 'complex' and would require several levels of nested IF statements. I can get the formula to work, but only if the expected outputs are either 'pass' or 'fail'. This is the formula:
=IF(OR(C2="N/A",D2="N/A",AND(B2="CERO",OR(D2="Yes",D2="No"))),"Pass","Fail")
However, I need a formula which can handle multiple fail conditions depending on different permutations of user input to cells B2, C2 & D2.
I'm hoping that if you copy and paste the bold text below into an Excel worksheet, it should put place these in an understandable grid format.
Formula goes in this column Obligation Sub Category Rural Area Rural Sub Obligation
Pass N/A
Fail - rural area must be N/A
Pass CERO Yes
Pass CERO No
Fail - rural sub obligation is invalid CERO any text input
Fail - rural sub obligation is blank CERO
Pass any text input N/A
Fail - rural sub obligation is blank any text input
If you provide any help or guidance on this it would be very much appreciated.
Best Regards,
Cal
RE: nested IF statements
Hi Calum,
Thank you for the forum question.
If I understand what you need I would use another way of doing it.
In the attached file you will find an example. I am using an array function. You will need to type the Index and Match function and the press Ctrl Shift enter.
I hope it makes sense, what I have done. Otherwise please let me know.
Have a nice weekend.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Attached files...
RE: nested IF statements
Sorry Jens, I cannot see the attached file?
I will email you on Monday, have a good weekend too.
Regards,
Calum
RE: nested IF statements
Hi Calum,
Please find the attached example under my signature in this reply. I am sorry I made a tiny mistake in the first answer.
If you cannot see the reply please refresh the browser and it will be under my signature.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Attached files...
RE: nested IF statements
Hi Jens,
Apologies, I could only see the attachment after I replied!
Many thanks for taking the time to respond with a solution, its very much appreciated. Unfortunately it doesn't help with my problem as the spec I'm working on dictates that I use IF statements.
Is there any way I can send you / or upload the excel file in order to explain better?
Best Regards,
Calum
RE: nested IF statements
Hi Calum,
You can send the workbook to info@stl-training.co.uk
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
RE: nested IF statements
Hi Cal
The method Jens suggested is shorter than using nested IF statements. Here is the nexted IF formula:
=IF(OR(B2="N/A",AND(B2="CERO",C2="Yes"),AND(B2="CERO",C2="No"),AND(B2<>"",C2="N/A")),"Pass",IF(C2="N/A","Fail - rural area must be N/A",IF(AND(B2="CERO",C2="",D2="N/A"),"Fail - rural sub obligation is invadid CERO any text input",IF(AND(C2="",B2="CERO"),"Fail - rural sub obligation is blank CERO",IF(AND(D2="",B2<>""),"Fail - rural sub obligation is blank any text input")))))
I'll attach the file so you can make midifications if ned be.
The first IF part evaluates all the possible cases for "Pass" and the remaining 4 IFs evaluate the various types of "Fail - ..."
Your question shows the advantage of an array Index & Match formula if you are allowed to use them.
Regards
Doug
STL
Attached files...
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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:The dual nature of toolbar buttonsMany toolbar buttons are dual purpose, though the two purposes are often linked in some way. For example, Align Left aligns a cell's contents to the left of the cell. However, hold down Shift and press the Align Left button: Excel aligns the cell contents to the right. |