IF / AND Statement

bickersc

New Member
Joined
Aug 7, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am trying to write a statement in regards to if a part is less than 36" to use (PART #), if part is greater than 36" & less than 48" to use (PART #), if part is greater than 48" to use (PART #).
I currently have tried this statement: =IF(L17<36,"8092SB EB 36",IF(AND(L17>36,L2<48,L2,"8092SB EB 48",IF(L2>48,"8092SB EB 72")))) but I keep getting an error and I can not figure out the problem nor a solution.

Any help would be appreciated.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi & welcome to MrExcel.
How about
Excel Formula:
=IF(L17<36,"8092SB EB 36",IF(L17<48,"8092SB EB 48","8092SB EB 72"))
 
Upvote 0
And just to show you where the issue with your current formula is:

=IF(L17<36,"8092SB EB 36",IF(AND(L17>36,L2<48,L2,"8092SB EB 48",IF(L2>48,"8092SB EB 72"))))

should be

=IF(L17<36,"8092SB EB 36",IF(AND(L17>36,L2<48),"8092SB EB 48",IF(L2>48,"8092SB EB 72","")))

Though I am not sure why you are using both L17 and L2 in the comparison. Seems to give inaccurate results.
 
Upvote 0
Just as a side note, consider if the part is 36" or 48". Your equation, when working per @dreid1011 's corrections, will ignore parts that are those exact lengths. If it is possible to have those lengths, then you may need to change some of the operators to "<=" or ">=".

In @Fluff 's simplification, if the part is 36", it will fall in with parts that are <48". Just make sure everything is falling into the correct buckets.
 
Upvote 0
And just to show you where the issue with your current formula is:

=IF(L17<36,"8092SB EB 36",IF(AND(L17>36,L2<48,L2,"8092SB EB 48",IF(L2>48,"8092SB EB 72"))))

should be

=IF(L17<36,"8092SB EB 36",IF(AND(L17>36,L2<48),"8092SB EB 48",IF(L2>48,"8092SB EB 72","")))

Though I am not sure why you are using both L17 and L2 in the comparison. Seems to give inaccurate results.
Boom, perfect, thank you so much......yes I missed the L2's which should have been L17's
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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