Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Please Help! Nested If Formula

0

i have 4 Cells, B2, C2, D2 and E2. 
Formula will be in B2. 
If C2,D2 & E2 are blank, then B2 is Blank 
If C2 is Not Blank, then B2 = C2 
If C2 & D2 are not Blank, then B2 = D2 
If C2, D2 & E2 are not blank, then B2 = E2 
But sometimes i get answer only in D2 or E2, 
I want B2 to be = to D2 or E2 even if C2 or D2 is also Blank 
I hope what i ask is understandable.

Answer
Discuss

Discussion

Is what you want either the result in the rightmost column or a blank when there is no data in any of the columns?
gebobs (rep: 30) May 22, '17 at 10:38 am




            B           C              D            E 1   Final Answer       Answer1       Answer2       Answer3 2       APPLE         APPLE - -                       B           C           D           E 1    Final Answer       Answer1       Answer2       Answer3 2       BANANA           APPLE       BANANA -                       B           C           D           E 1    Final Answer       Answer1       Answer2       Answer3 2       ORANGE         APPLE       BANANA       ORANGE                       B           C           D           E 1    Final Answer       Answer1        Answer2       Answer3 2       BANANA -       BANANA -                       B           C           D            E 1 Final Answer       Answer1        Answer2       Answer3 2       ORANGE - -       ORANGE
IF(ISBLANK(C2),"",C2)
IF(ISBLANK(D2),C2,D2)
IF(ISBLANK(E2),D2,E2)

BUT SOMETIMES I GET ANSWER ONLY IN ANSWER3.
I NEED TO GET THE FINAL ANSWER FROM THE LAST ANSWER I GET.

THANK YOU
Antonio May 23, '17 at 12:24 am
sorry, there was a table when i post it
Antonio May 23, '17 at 12:25 am
If you want to show more information, just upload a sample Excel file to your question.
don (rep: 1989) Jun 4, '17 at 1:35 am
Add to Discussion

Answers

0

 This formula my be help you

=IF(C2<>"",D2,IF(AND(C2="",D2="",E2=""),"",IF(C2<>"",C2,E2)))

Discuss
0

This formula will return the value from the last column available. Meaning, it doesn't matter if there is anything in C and D, if E is available that is the value which will be returned.

=IF(COUNTA(E2), E2,IF(COUNTA(D2),D2,IF(COUNTA(C2),C2,"")))

Replace COUNTA with COUNT if the values in the tested cells should be numbers. COUNTA checks if there is any content at all, number or text.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login