Need help to unravel nested if statement in formula. (fomula to VBA code)

Richard U

Active Member
Joined
Feb 14, 2006
Messages
406
Office Version
  1. 365
  2. 2016
  3. 2010
  4. 2007
Platform
  1. Windows
I have this formula

=IF(OR((IF(‘Sheet 1’!AJ6=0;""; ‘Sheet 1'!AJ6))="";(IF(‘Sheet 1'!AJ6=0;""; ‘Sheet 1'!AJ6))=" ");"~";IF(LEFT(‘Sheet 1'!AM6;3)="940";"RSW INPUT";IF(LEFT(‘Sheet 1'!AM6;3)="401";"REU INPUT";IF(LEFT(‘Sheet 1'!AM6;3)="200";"ANZ INPUT";IF(RIGHT($M6;2)="MX";"#N/A";IF(‘Sheet 1'!AN6="COMPANY NAME";"RNA INPUT";VLOOKUP(E6&" "&(IF‘Sheet 1'!AJ6=0;"";'Portal Data'!AJ6));Sarep!$B$4:$C$291;2;"FALSE")))))))


Which I need to translate into some maintainable VBA code, but I can't quite figure out what this is doing. I'm a good coder, but the nested excel formulas confuse me.


Could someone please explain what this formula is doing? I can write the code myself once I understand the logic, but I can't seem to unravel this myself
 
Try changing your delimiter in windows regional option from comma to semi colon and you can all have semi colons in a formula so possibly NOT a syntax error
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Cerfani,
Are you sure about that substitute conditional test?

Here's a little data table:

OR()=0
spaceTRUEFALSE
blankTRUETRUE
empty stringTRUEFALSE
zero0TRUETRUE

<tbody>
</tbody>

B2 contains a space, " ".
B3 is blank.
B4 contains an empty string, =ISBLANK(B4) returns false.
B5 contains a zero, 0.

In cell C3 and dragged down:
=OR(B2=0, B2="", B2=" ")

In cell D3 and dragged down:
=B2=0
 
Upvote 0
yeah im sure... he is just checking ‘Sheet 1’!AJ6=0 and if true he replaces with "" then he checks if the value returned was "" ... so he can just check for the original boolean
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,039
Members
448,940
Latest member
mdusw

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