DangerousTreacle
DangerousTreacle

Reputation: 71

Microsoft Excel - If, AND & OR statement

Hi I'm trying to write a parcel size calculation to determine whether the parcel is 'small', 'medium', large or 'too big', in Microsoft Excel.

It very similar to the one on the bottom MyHermes website (https://www.myhermes.co.uk/help/parcel-size.html)

Here is my code.

Thank you Brian

=IF(OR(B4<=45) AND (C4<=35) AND (D4<=16) AND (E4<=2), ”SMALL”,

IF(OR(B4>45 AND <61) AND (C4>35 AND <47) AND (D4>16 AND >47) AND(E4>2 AND <21),”MEDIUM”,

IF(OR(B4>60 AND <101) AND (C4>46 AND <101) AND (D4>46 AND >101) AND(E4>20 AND <31),”LARGE”,"TOO BIG",)))

Upvotes: 2

Views: 83

Answers (1)

user4039065
user4039065

Reputation:

B4>45 AND <61 is redundant; change to B4<=61 and all the others. Your AND / OR syntax is malformed.

=IF(and(B4<=45, C4<=35, D4<=16, E4<=2), "SMALL",
 IF(and(b4<=61, C4<=47, D4<=47, E4<=21), "MEDIUM",
 IF(and(B4<=101, C4<=101, D4<=101, E4<=31), "LARGE", "TOO BIG")))

Upvotes: 3

Related Questions