Confounding Behavior with IF Statement

Hello all,

I've run into an issue around what should be an entry level IF statement. I'm comparing numbers in two columns, one of which is derived from a time calculation. The formula is looking to determine if the two values are greater than or equal to one another and outputs a simple "Yes" or "No" depending on the values. I have an instance where the two values are equal but the formula is yielding "No."

I've reached out to customer support who suggested I clear the values, save the sheet, add them again and check. I received the same answer via the formula.

Thank you in advance.

Tags:

Best Answer

  • dojones
    dojones ✭✭✭✭✭
    Answer ✓

    This formula works.

    =IF(AND([In - Min Hours]@row <= [In - Total Hours Worked]@row, [In - Min Hours]@row <> ""), "Yes", IF([In - Total Hours Worked]@row = "", "", "No"))

    If you copy and it's not working, then try entering numbers in the In - Min Hours and In - Total Hours Worked. It's possible there is some fraction of a second beyond what is showing causing the issue so you may want to round it in the formula.

Answers

  • dojones
    dojones ✭✭✭✭✭
    Answer ✓

    This formula works.

    =IF(AND([In - Min Hours]@row <= [In - Total Hours Worked]@row, [In - Min Hours]@row <> ""), "Yes", IF([In - Total Hours Worked]@row = "", "", "No"))

    If you copy and it's not working, then try entering numbers in the In - Min Hours and In - Total Hours Worked. It's possible there is some fraction of a second beyond what is showing causing the issue so you may want to round it in the formula.

  • Khari Shiver
    Khari Shiver ✭✭✭✭✭

    You were correct regarding there being a rounding issue. Although both appear to be the same, placing ROUND in the IN - Total Hours Worked did the trick. Thank you for the suggestion.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!