Expanding Nested IF

lisa6538

New Member
Joined
Oct 26, 2016
Messages
3
I have a nested IF statement that I need to expand if a new column is added which happens often. Wondering if there is a better way to handle this?

Here's my formula
=IF($A$4=$D$4,$D7,IF($A$4=$E$4,$E7,IF($A$4=$F$4,$F7)))

If works perfectly, except I will be adding a column G next month and H the following month, etc. I tried to nest an OR in the IF statement which works for the logical test, but not for the value if true.

Any suggestions would be appreciated.

Thank you!
 
If I am understanding this correctly, the MATCH part only needs to return a column number based on the contents of row 4, so this should work without Ctrl + Shift + Enter:

=INDEX($D7:$ZZ7,MATCH($D$4,$D$4:$ZZ$4,0))

I use look up columns from D to ZZ.
As the formula is dragged down the row to be looked up and copied to column B will vary.
I note, this substitutes zeroes for blanks as well.


Regards,
 
Last edited:
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try =INDEX($D7:$ZZ7&"",MATCH($D$4,$D$4:$ZZ$4,0))

It should suppress 0s in blank cells.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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