# Formula

Copper Contributor

# Formula

=IF((D4<=0,E4)*IF((D4>0,D4*E4)) Why won't my formula work?

6 Replies

# Re: Formula

I've never said this in my life, but there are too many parenthesis. =IF(D4<=0,E4)*IF(D4>0,D4*E4) This works.

# Re: Formula

It does work! Thank you.

# Re: Formula

Consider using the formula help to learn how to write the most efficient formulas. The shorter the formula the easier it is to sort out errors in logic, which is different to constructing the actual formula. Simple logic maked writing the formula easier.

Your formula is not efficient as it has unnecessary elements

IF((D4<=0,E4)*IF((D4>0,D4*E4))

This formula works and is efficient

=IF(D4<=0,E4,D4*E4)

IF(D4<=0     The condition you are seeking first is- D4 is less than or equal to 0  is called the logical test

E4,  Is what you want if TRUE

Therefore if the logical test is FALSE it automatically follows that D4 must have a value more than 0. (your formula unnecessarily states this)

Therefore all you need to specify is what you want if the logical test is FALSE i.e. D4*E4

You only need one IF statement to cover both True and False per single logical test. Later you can nest multiple IF statements.

It would appear you are learning Excel, try using the formula analysis tool that pops up under the formula window, click on each element sentence to analyse your formula and you will see the errors. Have fun , Excel is great

# Re: Formula

And by the magic of multiplication the result is always 0.

# Re: Formula

Thank you very much,

# Re: Formula

@Detlef_Lewin "They're illusions, Michael."