How to "compress" nested IFs

Hatzimichelakis

New Member
Joined
Nov 22, 2017
Messages
8
Hello.
I have a formula like this:
=IF(A8=1;$A$5;IF(A8=2;$B$5;IF(A8=3;$C$5;IF(A8=4;$D$5;IF(A8=5;$E$5;IF(A8=6;$F$5;IF(A8=7;$G$5;IF(A8=8;$H$5;IF(A8=9;$I$5;IF(A8=10;$J$5))))))))))

Is there any way to avoid all these Ifs (because I need to another similar formula to use IF for 88 times!)

Thanks for your time.
George
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi,

If your result cells are contiguous as in your sample, Norie's formula works perfect and is much cleaner.
But if your result cells are not necessarily contiguous, then the following might work:

=CHOOSE(A8,$A$5,$B$5,$C$5,$D$5,$E$5,$F$5,$G$5,$H$5,$I$5,$J$5)
 
Upvote 0
Thank you very much, Norie.
I tried your formula, and I found that this is better for me: =INDEX($A5:$I5,,A8).

Your help was valuable.
Thanks a lot for your time.
George Hatzimichelakis
 
Upvote 0
Thank you very much, Norie.
I tried your formula, and I found that this is better for me: =INDEX($A5:$I5,,A8).

Your help was valuable.
Thanks a lot for your time.
George Hatzimichelakis
 
Upvote 0
Perhaps.

=INDEX(A5:I5,, A8)

Norie, may I have your help for a variation of the formula? I cannot modulate your formula for this: =IF(A$12=$A5;$A4;IF(A$12=$B5;$B4;IF(A$12=$C5;$C4;IF(A$12=$D5;$D4;IF(A$12=$E5;$E4;IF(A$12=$F5;$F4;IF(A$12=$G5;$G4;IF(A$12=$H5;$H4;IF(A$12=$I5;$I4;IF(A$12=$J5;$J4))))))))))

Thanks for your time.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top