# More than 2 logical expressions for OR function?

Options
✭✭✭

I'm trying to write an OR function that returns an RYGB ball with 3-4 logical expressions but it keeps giving me an error message. Can it only have 2 logical expressions? Here's my formula (i didn't add the Blue logic yet since I couldn't even get the 3 conditions to work) -

=IF(OR((TODAY() - [Due Date]@row) >= 14, (TODAY() - [Due Date]@row) <= 13, (TODAY() > [Due Date]@row)), "Green", "Yellow", "Red")

The logic is:

If today’s date is >= 14 days from the Due Date, then green ball

If today’s date is <= 13 days days from the Due Date, then yellow

If today’s date is past the Due Date, then red

If today’s date is is past the Due Date, then blue

Thank you!

Options

You are giving two different options ("Yellow" and "Red") if the logical expression is not met. You must put the desired outcome immediately following each logic check, and the final one is the "every other instance".

=IF(logical_expression, value_if_true, [value_if_false])

[value if false] is where you would put the second logic check and associated color following it, and down the line.

Hope this helps.

• ✭✭✭✭✭✭
Options

Yes. Your blue is redundant, but it is not the same as Today's Date >=Due Date.

Today's Date >=Due Date is the same as the "Red" criteria. Your Blue criteria is a combination of your "Yellow" and "Green".

Taking out the redundancy of the "Blue", you would have something along the lines of...

=IF(TODAY() > [Due Date]@row, "Red", IF(TODAY(14) <= [Due Date]@row, "Green", "Yellow"))

Options

You are giving two different options ("Yellow" and "Red") if the logical expression is not met. You must put the desired outcome immediately following each logic check, and the final one is the "every other instance".

=IF(logical_expression, value_if_true, [value_if_false])

[value if false] is where you would put the second logic check and associated color following it, and down the line.

Hope this helps.

• ✭✭✭✭✭✭
Options

The criteria you have listed is the same for Red and Blue. Can you specify that?

• ✭✭✭
Options

Apologies ...

The logic is:

If today’s date is >= 14 days from the Due Date, then green ball

If today’s date is <= 13 days days from the Due Date, then yellow

If today’s date is past the Due Date, then red

If today’s date is earlier than or equal to the Due Date, then blue (but is that redundant with Today's Date >=Due Date?)

• ✭✭✭✭✭✭
Options

Yes. Your blue is redundant, but it is not the same as Today's Date >=Due Date.

Today's Date >=Due Date is the same as the "Red" criteria. Your Blue criteria is a combination of your "Yellow" and "Green".

Taking out the redundancy of the "Blue", you would have something along the lines of...

=IF(TODAY() > [Due Date]@row, "Red", IF(TODAY(14) <= [Due Date]@row, "Green", "Yellow"))

• ✭✭✭
Options

Thank you! This worked!

• ✭✭✭✭✭✭
Options

Happy to help! 👍️

• ✭✭✭
edited 06/16/20
Options

I have another question for this. I realized I missed one of the criteria.

If Signed Agreement Received IS NOT checked and

• today’s date is >= 14 days from the Due Date, then green ball
• If today’s date is <= 13 days days from the Due Date, then yellow
• If today’s date is past the Due Date, then red
• If today’s date is earlier than or equal to the Due Date, then blue (but is that redundant with Today's Date >=Due Date?)

Here's my formula that seems to be working.

=IF([Signed Agreement Received]@row = 0, IF(TODAY() > [SA Due Date]@row, "Red", IF(TODAY() = [SA Due Date]@row, "Blue", IF(TODAY() < [SA Due Date]@row, "Green", "Yellow"))))

How do I add if the box IS checked

If Signed Agreement Received IS checked then blue.

Right now, once the box is checked, the RYGB ball just disappears altogether and the cell is left blank.

• ✭✭✭✭✭✭
Options

Since your very first IF is specifying the box NOT being checked, then we run a series of nested IF's for the "if true" portion of that, then we can just put the output into the third "else" portion of that first IF for when the box being not checked is false.

=IF([Signed Agreement Received]@row = 0, IF(TODAY() > [SA Due Date]@row, "Red", IF(TODAY() = [SA Due Date]@row, "Blue", IF(TODAY() < [SA Due Date]@row, "Green", "Yellow"))), "Blue")

• ✭✭✭
Options

That worked! thank you!

• ✭✭✭✭✭✭
Options

Happy to help! 👍️

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!