Welcome to the Smartsheet Forum Archives


The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.

Number Range for Logic Function

Shalise
Shalise
edited 12/09/19 in Archived 2017 Posts

Hello! I have a range of numbers I need to include in a logic function, specifically:

< 3 = XS

4-8 = S

9-16= M

17-39= L

>40= XL

 

This is my logic string, and I've used a similar one in a previous sheet, but I know my number range isn't correct, but cannot figure out how it should be. Thanks for any help!

=IF([Effort Required in Hours]1 = <4, "XS", IF([Effort Required in Hours]1 = 4 and <9, "S", IF([Effort Required in Hours]1 = 9 and <17, "M", IF([Effort Required in Hours]1 = 17 and <40, "L", IF([Effort Required in Hours]1 = >40, "XL")))))

Tags:

Comments

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭

    Your and statements aren't inputted correctly... Try this and see if it works. 

    =IF([Effort Required in Hours]1 = <4, "XS", IF(AND([Effort Required in Hours]1 = 4, [Effort Required in Hours]1 <9), "S", IF(AND([Effort Required in Hours]1 = 9, [Effort Required in Hours]1 <17), "M", IF(AND([Effort Required in Hours]1 = 17, [Effort Required in Hours]1 <40), "L", IF([Effort Required in Hours]1 = >40, "XL")))))

  • It still says "Invalid Operation", but that is much closer. I'll see if I can play around with it more to get it to work. Thank you!

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭
    edited 06/01/17

    I see the issue... :) 

    Try this and see if it works. 

    =IF([Effort Required in Hours]1 <4, "XS", IF(AND([Effort Required in Hours]1 >= 4, [Effort Required in Hours]1 < 9), "S", IF(AND([Effort Required in Hours]1 >= 9, [Effort Required in Hours]1 < 17), "M", IF(AND([Effort Required in Hours]1 >= 17, [Effort Required in Hours]1 <40), "L", IF([Effort Required in Hours]1 >= 40, "XL")))))

    I use this link to troubleshoot error messages in SmartSheets



    https://help.smartsheet.com/articles/2476176-formula-error-messages

     

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭

    I made a couple edits to that formula I reposted - make sure to load the thread and test it as written. 

  • You are brilliant and that worked! Thank you so much!

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭

    You're welcome!

  • Just on a side note, the additional checks for greater or equal are unnecessary.  IF statements stop on the first match.  So by default, if it didn't match "<4", it's automatically ">=4".  This can greatly simplify the calculations:

    =IF([Effort Required in Hours]1 <4, "XS", IF([Effort Required in Hours]1 < 9), "S", IF([Effort Required in Hours]1 < 17), "M", IF([Effort Required in Hours]1 <40), "L", "XL"))))

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭

    Good point! That is true and makes for a simpler calculation. Nice revision.  

  • I'm trying to do something similar but I keep getting #UNPARSEABLE. I cannot see what I've typed wrong.

    =IF([Points]1 <99, IF([Points]1 <199, “Apprentice”, IF([Points]1 <499, “Amateur”, IF([Points]1 <999, “Pro”, IF([Points]1 <1999, “Veteran”, IF([Points]1 <= 3999, “Expert”, IF([Points]1 = 4000, “Master”)))))))

    Thoughts on what I might be missing?

This discussion has been closed.