Nested IF statements

guybrown

Board Regular
Joined
Jul 2, 2008
Messages
100
Hi

Are there any etiquites / preferred formats or any restrictions regarding IF THEN IF THEN formulas.

For example is it better to have:

IF ? then IF ? then ? else ?:
=IF(A1<>"",IF(A1=1,1,"not 1"),"empty cell")

or

IF ? then ? else IF ? then ? else ?
=IF(NOT(A1<>"","empty cell",IF(A1=1,1,"not 1")

Also, sometimes I get lost in my formulas. Usually any issues I have are because of the incorrect presence or lack of brackets.
Is it better to have ((((())))) or ()()()()() through formulas?
Also are there any tips on how to scan for brackets in their relation to comma's to quickly identify 'sections' of a formula?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi

Are there any etiquites / preferred formats or any restrictions regarding IF THEN IF THEN formulas.

For example is it better to have:

IF ? then IF ? then ? else ?:
=IF(A1<>"",IF(A1=1,1,"not 1"),"empty cell")

or

IF ? then ? else IF ? then ? else ?
=IF(NOT(A1<>"","empty cell",IF(A1=1,1,"not 1")

Also, sometimes I get lost in my formulas. Usually any issues I have are because of the incorrect presence or lack of brackets.
Is it better to have ((((())))) or ()()()()() through formulas?
Also are there any tips on how to scan for brackets in their relation to comma's to quickly identify 'sections' of a formula?

Parens (parentheses) must be used when required and occasionally for clarification.

Two tips:

Every function has an opening paren and a closing paren.

Use the programmer's 'structured' write-down technique...

IF(A1 <> "",
..IF(A1 = 1,
....1,
...."not 1"),
.."empty cell")

Many logical expressions can be re-written...

IF(AND(A1 = "FAD", B1 = 10),...

===>

IF(A1 = "FAD", IF(B1 = 10,...

You could look up a short intro into propositional logic for the re-write rules...
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,142
Members
452,892
Latest member
JUSTOUTOFMYREACH

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