if / or / contains

Options

Hello, I need some help with a formula using if / or / contains.

If the cell contains "card", return the words "Business Card", or if the cell contains "page, return the words "1/4 Page", otherwise keep blank.

I can get part way there: =IF(CONTAINS("business", [Spring / Summer Newsletter Ad Size]@row), "Business Card", "") I just can't the rest of it to work.


Thanks.

Best Answer

  • Sam M.
    Sam M. ✭✭✭✭✭
    Answer ✓
    Options

    Hi Chevon,

    Maybe this formula can help:

    =IF(CONTAINS("card", [Spring / Summer Newsletter Ad Size]@row), "Business Card", IF(CONTAINS("page", [Spring / Summer Newsletter Ad Size]@row), "1/4 Page", ""))

    I did some testing:


    The part that is purple contains the formula.

    The formula is made out of a nested IF, it is an IF inside an IF.

    For example:

    =IF(put condition here, when true this happens, when false this happens)

    In the true and false section you can keep adding another if.

    =IF(put condition here, when first if is true then IF(put condition here, when true this happens, when false this happens), when first if is false this happens or you can put another if here)

    Hope it helps,

    Sam

Answers

  • Sam M.
    Sam M. ✭✭✭✭✭
    Answer ✓
    Options

    Hi Chevon,

    Maybe this formula can help:

    =IF(CONTAINS("card", [Spring / Summer Newsletter Ad Size]@row), "Business Card", IF(CONTAINS("page", [Spring / Summer Newsletter Ad Size]@row), "1/4 Page", ""))

    I did some testing:


    The part that is purple contains the formula.

    The formula is made out of a nested IF, it is an IF inside an IF.

    For example:

    =IF(put condition here, when true this happens, when false this happens)

    In the true and false section you can keep adding another if.

    =IF(put condition here, when first if is true then IF(put condition here, when true this happens, when false this happens), when first if is false this happens or you can put another if here)

    Hope it helps,

    Sam

  • Malaina Hudson
    Malaina Hudson ✭✭✭✭✭
    Options

    Hi, @Chevon Brownell ,


    When using IF with CONTAINS, they tend to work better as a Nested IF instead of as an OR function. Try this:

    =IF(CONTAINS("card", test@row), "Business Card", IF(CONTAINS("page", test@row), "1/4 Page"))

    where "test" is the name of the column you are referencing.

    Let me know if this helps solve your problem.

  • Chevon Brownell
    Options

    Thanks Sam. Your formula worked!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!