How do I check if a number is in a range of numbers (not a range of cells). For example in many programming languages I can write a >= 1 && a <= 7. How do I express this in Google Sheets?
I tried to apply this solution , but how would that formula work in order to handle multiple ranges? For example:
C12 = 5
I want to check if C12 is either in ranges:
I'm trying the following but it's not working:
=IFS(AND(C12>=1,C12<=10),"1-10",(AND(C12>=11,C12<=25),"11-25","26-50"))
IFS need pairs and it will short circuit at the first TRUE so we can shorten it to:
=IFS(C12<=10,"1-10",C12<=25,"11-25",TRUE,"26-50")
Or we can use CHOOSE:
=CHOOSE(MATCH(C12,{1,11,26}),"1-10","11-25","26-50")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.