Nested IF statement

T

Teri

What did I do wrong?

Here's the scenario and the formula I wrote: If the value of D48 X C13 is
less than B13, the value should be B13. If the Value of D48 X C13 is greater
than D13, the value should be D13. Otherwise the value should be D48 X C13.


=IF(AND(D48*C13<B13),B13,"(IF(AND(D48*C13>D13,D13)OR(D48*C13)")
 
D

David Biddulph

What did you do wrong?

1 You've got an AND with only one argument, so unnecessary.
2 You've got quotes round most of the tail end of the formula, so it's a
text string and is not being evaluated.
3 Your second AND is combining the D48*C13>D13 with D13, so it is therefore
effectively treating D13 as a logical (but again you didn't need an AND
here).
4 You've got no commas to divide the arguments of your second IF.
5 You've only got one argument for your OR function, so again it isn't doing
anything.
6 Your parentheses don't match.
....

Is that enough to be going on with?

You need to look at the syntax of the various Excel functions (and Excel's
help will aid you in following this through), and then fill in the various
arguments for the functions as you go.

If you want to do it using IF functions as you've expressed it, then it will
come out something like:
=IF(D48*C13<B13,B13,IF(D48*C13>D13,D13,D48*C13))

but you can simplify it to =MAX(B13,MIN(D13,D48*C13)) or
=MEDIAN(B13,D48*C13,D13)
 
T

Teri

You are WONDERFUL! Thank you :)

David Biddulph said:
What did you do wrong?

1 You've got an AND with only one argument, so unnecessary.
2 You've got quotes round most of the tail end of the formula, so it's a
text string and is not being evaluated.
3 Your second AND is combining the D48*C13>D13 with D13, so it is therefore
effectively treating D13 as a logical (but again you didn't need an AND
here).
4 You've got no commas to divide the arguments of your second IF.
5 You've only got one argument for your OR function, so again it isn't doing
anything.
6 Your parentheses don't match.
....

Is that enough to be going on with?

You need to look at the syntax of the various Excel functions (and Excel's
help will aid you in following this through), and then fill in the various
arguments for the functions as you go.

If you want to do it using IF functions as you've expressed it, then it will
come out something like:
=IF(D48*C13<B13,B13,IF(D48*C13>D13,D13,D48*C13))

but you can simplify it to =MAX(B13,MIN(D13,D48*C13)) or
=MEDIAN(B13,D48*C13,D13)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top