IF statement for multiple IDs

I have a column with multiple IDs and I want to select specific IDs and "complete" = 1 else 0.

My current formula is :

=IF(CONTAINS("000", [GAP Status ID]@row, 1, IF(CONTAINS("010", [GAP Status ID]@row, 1, IF(CONTAINS("020", [GAP Status ID]@row, 1, IF(CONTAINS("100", [GAP Status ID]@row, 1, IF(CONTAINS("110", [GAP Status ID]@row, 1, IF(CONTAINS("120", [GAP Status ID]@row, 1, IF(CONTAINS("130", [GAP Status ID]@row, 1, IF(CONTAINS("140", [GAP Status ID]@row, 1, IF(CONTAINS("150", [GAP Status ID]@row, 1, IF(CONTAINS("160", [GAP Status ID]@row, 1, IF(CONTAINS("900", [GAP Status ID]@row, 1, 0))))))))))))))))))))))

I get the error #INCORRECT ARGUEMNET SET. Not sure what I am doing wrong.

Best Answer

  • heyjay
    heyjay ✭✭✭✭✭
    edited 07/30/24 Answer ✓

    Close your Contains with )

    =
    IF(CONTAINS("000", [GAP Status ID]@row), 1, 
    IF(CONTAINS("010", [GAP Status ID]@row), 1, 
    IF(CONTAINS("020", [GAP Status ID]@row), 1, 
    IF(CONTAINS("100", [GAP Status ID]@row), 1, 
    IF(CONTAINS("110", [GAP Status ID]@row), 1, 
    IF(CONTAINS("120", [GAP Status ID]@row), 1, 
    IF(CONTAINS("130", [GAP Status ID]@row), 1, 
    IF(CONTAINS("140", [GAP Status ID]@row), 1, 
    IF(CONTAINS("150", [GAP Status ID]@row), 1, 
    IF(CONTAINS("160", [GAP Status ID]@row), 1, 
    IF(CONTAINS("900", [GAP Status ID]@row), 1, 
    0)
    

    We can further simplify:

    =IF(OR(
    CONTAINS("000", [GAP Status ID]@row), 
    CONTAINS("010", [GAP Status ID]@row), 
    CONTAINS("020", [GAP Status ID]@row), 
    CONTAINS("100", [GAP Status ID]@row), 
    CONTAINS("110", [GAP Status ID]@row), 
    CONTAINS("120", [GAP Status ID]@row), 
    CONTAINS("130", [GAP Status ID]@row), 
    CONTAINS("140", [GAP Status ID]@row), 
    CONTAINS("150", [GAP Status ID]@row), 
    CONTAINS("160", [GAP Status ID]@row), 
    CONTAINS("900", [GAP Status ID]@row)
    ), 1, 0)
    

    ...

Answers

  • heyjay
    heyjay ✭✭✭✭✭
    edited 07/30/24 Answer ✓

    Close your Contains with )

    =
    IF(CONTAINS("000", [GAP Status ID]@row), 1, 
    IF(CONTAINS("010", [GAP Status ID]@row), 1, 
    IF(CONTAINS("020", [GAP Status ID]@row), 1, 
    IF(CONTAINS("100", [GAP Status ID]@row), 1, 
    IF(CONTAINS("110", [GAP Status ID]@row), 1, 
    IF(CONTAINS("120", [GAP Status ID]@row), 1, 
    IF(CONTAINS("130", [GAP Status ID]@row), 1, 
    IF(CONTAINS("140", [GAP Status ID]@row), 1, 
    IF(CONTAINS("150", [GAP Status ID]@row), 1, 
    IF(CONTAINS("160", [GAP Status ID]@row), 1, 
    IF(CONTAINS("900", [GAP Status ID]@row), 1, 
    0)
    

    We can further simplify:

    =IF(OR(
    CONTAINS("000", [GAP Status ID]@row), 
    CONTAINS("010", [GAP Status ID]@row), 
    CONTAINS("020", [GAP Status ID]@row), 
    CONTAINS("100", [GAP Status ID]@row), 
    CONTAINS("110", [GAP Status ID]@row), 
    CONTAINS("120", [GAP Status ID]@row), 
    CONTAINS("130", [GAP Status ID]@row), 
    CONTAINS("140", [GAP Status ID]@row), 
    CONTAINS("150", [GAP Status ID]@row), 
    CONTAINS("160", [GAP Status ID]@row), 
    CONTAINS("900", [GAP Status ID]@row)
    ), 1, 0)
    

    ...

  • Thank you @heyjay ! That was it!!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!