Nested IF(AND statement

bchager

New Member
Joined
Dec 15, 2017
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hello all...

I'm trying to write a nested IF(AND statement. Below is as far as I've gotten:

=IF(AND(Order_Qty>1,Order_Qty<1000),Fixed_Order_Cost_Less_Than_1k*Order_Qty,0)

When I try to add a second or third nest, I receive an error. Below is an example of a formula that fails.

=IF(AND(Order_Qty>1,Order_Qty<1000),Fixed_Order_Cost_Less_Than_1k*Order_Qty,
IF(AND(Order_Qty=1000,Order_Qty<1999,Fixed_Order_Cost_1k*Order_Qty,0))

Any ideas?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello all...

I'm trying to write a nested IF(AND statement. Below is as far as I've gotten:

=IF(AND(Order_Qty>1,Order_Qty<1000),Fixed_Order_Cost_Less_Than_1k*Order_Qty,0)

When I try to add a second or third nest, I receive an error. Below is an example of a formula that fails.

=IF(AND(Order_Qty>1,Order_Qty<1000),Fixed_Order_Cost_Less_Than_1k*Order_Qty,
IF(AND(Order_Qty=1000,Order_Qty<1999,Fixed_Order_Cost_1k*Order_Qty,0))

Any ideas?

It could be a number of things. Here is what I saw:

Missing ")" on the second AND() function. AND(Order_Qty=1000,Order_Qty<1999)

Should the operator be "=" here? AND(Order_Qty=1000,Order_Qty<1999 If it should be "=", then there is no need for the AND() and it will never be true if it is not 1000. Perhaps you meant ">".
 
Last edited:
Upvote 0
It could be a number of things. Here is what I saw:

Missing ")" on the second AND() function. AND(Order_Qty=1000,Order_Qty<1999)

Should the operator be "=" here? AND(Order_Qty=1000,Order_Qty<1999 If it should be "=", then there is no need for the AND() and it will never be true if it is not 1000. Perhaps you meant ">".

Not sure about the end parenthesis. It doesn't seem to be fixing it. To your second point; I need to calculate the cost if the quantity is less than 1000, at least 1000, or at least 2000.
 
Upvote 0
Did you try both together then?

=IF(AND(Order_Qty>1,Order_Qty<1000),Fixed_Order_Cost_Less_Than_1k*Order_Qty,
IF(AND(Order_Qty>=1000,Order_Qty<1999),Fixed_Order_Cost_1k*Order_Qty,0))

Try this one.
 
Last edited:
Upvote 0
Did you try both together then?

=IF(AND(Order_Qty>1,Order_Qty<1000),Fixed_Order_Cost_Less_Than_1k*Order_Qty,
IF(AND(Order_Qty>=1000,Order_Qty<1999),Fixed_Order_Cost_1k*Order_Qty,0))

Try this one.

That worked. Thank you! So if I want to include the cost for a quantity of at least 3000, just add another nest and 3 end parentheses? I really appreciate your help here! FYI this is for a graduate level risk analytics course.
 
Upvote 0
If you're going to go to at least 3000, would that not be two more AND()'s? One more to check for 2000-2999 and the next to check for 3000+ ? Otherwise, yes, one more AND() just like you did the first, and another end parentheses. Just make sure you close the parentheses on each additional AND() too.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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