Classifying vehicles by weight and class number

Occasional Visitor

Hi there,


I have been working on this for a minute and know there must be an easier way to complete the function. 


I want to compare two columns in excel with the class number, and weight limit in order to determine which type of vehicle it is (passenger, light truck, etc.). Right now this is what I have but it returns an error (#NAME?) only on the correct column. 


=if(and(lower limit=>weight limit<=higher limit), X, "")


I am using X to notate which column has the correct classification. Why is my formula giving an error? Is there an easier way to do this? 



(I changed the data in the table with the classifications and classes to be horizontal because I found that was the only way to get my weird formula to work. It is not necessary to be that way)



EDIT: I forgot to put quotes around my value if true!! I fixed the spreadsheet!! But still, if you have an easier/less complex way to complete this task I would be so grateful. 

1 Reply
best response confirmed by KKawa355 (Occasional Visitor)

you need to separate the conditional parts and "=>" is wrong, not to mention it was pointing the wrong way:
=if(and(lower limit<=weight limit, weight limit<=higher limit), "X", "")
similar but alternatively
=if((lower limit<=weight limit)*(weight limit<=higher limit), "X", "")
=if(median(lower limit, weight limit, higher limit)=weight limit, "X", "")