Multiple IF conditions

Options

I need help with the IF function in a string based on multiple selections in a cell.

I need the formula to have difference values based on users selecting multiple items in a cell.

Follow is my attempt at the formula, but clearly not working:

=IF(HAS([RESOURCES]@row, "RESOURCE 1"), 1), IF([RESOURCES], "RESOURCE 1", "RESOURCE 2"), 2), IF([RESOURCES], "RESOURCE 1", "RESOURCE 2", "RESOURCE 3"), 3))

Image of the Smartsheet:

RESOURCES

TOTAL SHTS

RESOURCE 1
RESOURCE 2
RESOURCE 3

The formula should result with the following:

IF ONLY RESOURCE 1 IS SELECTED - THEN TOTAL SHEETS = 1

IF RESOURCE 1 AND 2 IS SELECTED - THEN TOTAL SHEETS = 2

IF RESOURCE 1, 2 AND 3 IS SELECTED - THEN TOTAL SHEETS = 3

Most probably pretty straight forward, but you never know!

Best Answer

  • Nick Korna
    Nick Korna ✭✭✭✭✭✭
    Answer ✓
    Options

    Hi @KempenUSA

    Is your RESOURCES column a dropdown that allows multiple selections? If so, you can use something like this:

    =IF(COUNTM(Resources@row) = 1, 1, IF(COUNTM(Resources@row) = 2, 2, IF(COUNTM(Resources@row) = 3, 3)))

    Alternatively if your resources are sequential (e.g 3 is never picked without 1 & 2, and 2 is never picked without 1) then you could use something like this:

    =IF(HAS(Resources@row, "Resource 3"), 3, IF(HAS(Resources@row, "Resource 2"), 2, IF(HAS(Resources@row, "Resource 1"), 1)))

    Hope this helps, but if you've any problems/questions then just let us know!

Answers

  • Nick Korna
    Nick Korna ✭✭✭✭✭✭
    Answer ✓
    Options

    Hi @KempenUSA

    Is your RESOURCES column a dropdown that allows multiple selections? If so, you can use something like this:

    =IF(COUNTM(Resources@row) = 1, 1, IF(COUNTM(Resources@row) = 2, 2, IF(COUNTM(Resources@row) = 3, 3)))

    Alternatively if your resources are sequential (e.g 3 is never picked without 1 & 2, and 2 is never picked without 1) then you could use something like this:

    =IF(HAS(Resources@row, "Resource 3"), 3, IF(HAS(Resources@row, "Resource 2"), 2, IF(HAS(Resources@row, "Resource 1"), 1)))

    Hope this helps, but if you've any problems/questions then just let us know!

  • KempenUSA
    KempenUSA ✭✭✭✭
    Options

    @Nick Korna Works perfect, Thank you!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!