Nested if then

Solved/Closed
chiflado Posts 5 Registration date Sunday 9 November 2014 Status Member Last seen 12 November 2014 - 9 Nov 2014 à 16:54
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 - 12 Nov 2014 à 17:10
Hello,

I would like to have the contents of b1 displayed in m2 if t2=1, the contents of b2 displayed in m2 if t2=2, the contents of c1 displayed in m2 if t2=3 etc all the way up to if t2=6.

Thanks.
Related:

5 responses

vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 262
9 Nov 2014 à 21:24
Hello Chiflado,

Is the following formula possibly what you need? Place it in M2:-

=IF(T2=1,B1,IF(T2=2,B2,IF(T2=3,C1,IF(T2=4,C2,IF(T2=5,D1,IF(T2=6,D2))))))

I'm assuming that you require the first two values in the first two rows of Columns "B", "C" and "D" placed in M2 once your values in T2 are entered.

Cheers,
vcoolio.
chiflado Posts 5 Registration date Sunday 9 November 2014 Status Member Last seen 12 November 2014
10 Nov 2014 à 13:52
Super! This is exactly what I'm looking for. I couldn't get the syntax right so I'm very thankful that you know what your doing! Thank you, thank you, thank you.
chiflado Posts 5 Registration date Sunday 9 November 2014 Status Member Last seen 12 November 2014
10 Nov 2014 à 13:55
Is there a way to do more than 7 nested if then statements?
chiflado Posts 5 Registration date Sunday 9 November 2014 Status Member Last seen 12 November 2014
10 Nov 2014 à 13:59
And... Is there a way to have M2 blank if T2 is blank? Right now it reads "FALSE" if nothing is in there.
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 262
10 Nov 2014 à 19:54
Hello Chiflado,

I believe that up to 64 IF functions can be nested in an If formula. You can probably pick up on the pattern in the formula above, so give it a try and see how it works.

To remove "False" from the cell, try this slightly amended formula:-

=IF(T2=1,B1,IF(T2=2,B2,IF(T2=3,C1,IF(T2=4,C2,IF(T2=5,D1,IF(T2=6,D2,""))))))

Regards,
vcoolio.
chiflado Posts 5 Registration date Sunday 9 November 2014 Status Member Last seen 12 November 2014
12 Nov 2014 à 12:16
Outstanding! Thank you very much. You've saved me a TON of work.
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 262
12 Nov 2014 à 17:10
You're welcome Chiflado. Glad I could help.

Cheers,
vcoolio.