Finding out the resulting action of a very long nested IF

MinhTNguyen

New Member
Joined
Oct 21, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a problem with a very long nested if formula (~10 level deep) that contain even more logical And statement in 1 IF, and at each level return a formula
i have tried the evaluation function but it return "2" directly
Ex: =IF(...IF(...IF(...IF(...IF(...,1+1,)...))))) ; i want to get "1+1" and not "2"

What i aim to do is analyze the formula with vba and return just the last resulting formula it use to calculate the end Value for the ease of understanding when other peoples read it

My current idea is to write all the last resulting formula in vba and compare it to the cell containing the If statement, but here lies the problem: Due to customizability of the table, the vba code wont be sure of which column it is on to compare the right set of formula to the If statement
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I have a problem with a very long nested if formula (~10 level deep) that contain even more logical And statement in 1 IF, and at each level return a formula
i have tried the evaluation function but it return "2" directly
Ex: =IF(...IF(...IF(...IF(...IF(...,1+1,)...))))) ; i want to get "1+1" and not "2"

What i aim to do is analyze the formula with vba and return just the last resulting formula it use to calculate the end Value for the ease of understanding when other peoples read it

My current idea is to write all the last resulting formula in vba and compare it to the cell containing the If statement, but here lies the problem: Due to customizability of the table, the vba code wont be sure of which column it is on to compare the right set of formula to the If statement
There is one way of doing it - but need some precautions with it
  • You can evaluate each statement by pressing F9 (check shortcut for your version)
  • It shall generate result for selected condition only
  • REMEMBER, to undo (Ctrl+Z) immediately after testing every condition else the value will become part of formula
    • You can't do multiple UNDO by testing one condition after another
Hope it helps you in some way.
 
Upvote 0

Forum statistics

Threads
1,214,556
Messages
6,120,190
Members
448,949
Latest member
keycalinc

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