Using multiple IF statements to return a value based on multiple ranges

Posted on

Whether you’re just starting out with Google Sheets or are a seasoned pro, sooner or later one of your formulas will give you a formula parse error message rather than the result you want. However, every Formula user, irrespective of whether it’s a beginner or expert, has invariably come across a formula parse error in Google Sheets at least once in their life (and if you haven’t. you soon will). It can be frustrating, especially if it’s a longer formula where the formula parse error may not be obvious. In this article, we will talk about some common formula parse errors in Google Sheets, like Using multiple IF statements to return a value based on multiple ranges, and how to fix it.

I’m trying to write an IF statement for whether an engine size is small (900 – 1400), medium (1401 – 2000) or large (>2000).

The engine sizes are in the B column.

I’m not really sure how to approach this. What I’ve currently written keeps returning an error:

=IF(AND(B2>=900;B2<=1400);"Small"), IF(AND(B2>=1401;B2<=2000);"Medium"), IF(B2>=2001),"Large"

I’d really appreciate it if anyone could point out what I’m doing wrong.

Answer :

Use ifs(), like this:

=ifs( 
  not(isnumber(B2)); iferror(1/0); 
  B2 < 900; "(leptonic)"; 
  B2 <= 1400; "Small"; 
  B2 <= 2000; "Medium"; 
  true; "Large" 
)

Leave a Reply

Your email address will not be published.