Search code examples
google-sheetsgoogle-sheets-formulags-vlookup

How to do a numerical range in a single cell?


For a spreadsheet idea i wanted to make a point based system depending on how many calories were consumed within a day, to do this I wanted to do a range style system I know in OOP languages you would take a variable, and do an IF ELSE (or switch) statement, but i'm not quite sure how to do it in a spreadsheet

=IF(D11<900,"-200"),=IF(D11<1200,"200"), =IF(D11<1500,"0")

In this code i wanted it so that, if less than 900 calories are consumed, there will be a 200 point penalty, and then from 900-1200 calories there is 200 points granted and then from then on like that


Solution

  • Nest the IF

    =IF(D11<900,-200,IF(D11<1200,200,IF(D11<1500,0,"Greater than 1500")))