Notion Answers

Help between Notion users


Register & Ask

It's free & easy

Get answers

Answers, votes & comments

Vote and select answers

Receive points, vote and give the solution

Question

1vote

Trouble with Nested IF Statement

I have a multi-select property which lists colors as the options. I am trying to create a formula property to display a colored emoji if the multi-select option is chosen. I've got the formula working well if only one option is chosen, but when more than one option is selected, no luck. I believe it's looking for an exact match, so I have changed the formula from == to a contains formula. However, it's telling me that I have too few arguments, and I can't for the life of me figure out what's missing.

Here is the formula that IS working when only one option is selected:

if(prop("Color") == "White", "⚪", if(prop("Color") == "Red", "", if(prop("Color") == "Green", "", if(prop("Color") == "Blue", "", if(prop("Color") == "Purple", "", if(prop("Color") == "Black", "⚫", ""))))))

Here is the formula that has too few arguments where I'm trying to make this work with multi-select:

if(contains(prop("Color"),"White"), "⚪", if(contains(prop("Color"),"Red"), "", if(contains(prop("Color"),"Green", "", if(contains(prop("Color"),"Blue", "", if(contains(prop("Color"),"Purple", "", if(contains(prop("Color"),"Black", "⚫", ""))))))))))

What am I missing? Thanks so much!

Edit: The code in this post isn't showing up properly because of the emojis, please see this screenshot for an accurate view of the formulas:

screenshot

0vote

polle commented

What is missing here is what you are trying to achieve. If it is select or multi select is the same, what it is important are the arguments you need and the logic behind it for the Notion formula.

If color is blue, do this, otherwise, do this.

What is your scenario for the one not working?

Please share it to understand and know how the formula should be.

1vote

greystonegirl16 commented

The logic is:

If the multi-select says White, return white emoji, if not then

  • If the multi-select says Red, return red emoji, if not then
    -- If the multi-select says Green, return green emoji, if not then
    --- If the multi-select says Blue, return blue emoji, if not then
    ---- If the multi-select says Purple, return purple emoji, if not then
    ----- If the multi-select says Black, return black emoji, if not then
    ------ Leave it empty

So if both Blue and Purple are selected, both blue and purple emojis will be returned.

1 Answer

0vote

polle Points79040

Here you have an example with some of the conditions. You will have to extend it with all the color combinations you need.

if(prop("Color") == "White", "-whitecircle-", if(prop("Color") == "White, Red", "-whitecircle- -redcircle-", if(prop("Color") == "White, Red, Green", "-whitecircle- -redcircle- -greencircle-", if(prop("Color") == "Red", "-redcircle-", if(prop("Color") == "Red, White", "-redcircle- -whitecircle-", if(prop("Color") == "Red, White, Green", "-redcircle- -whitecircle- -greencircle-", if(prop("Color") == "Green", "-greencircle-", if(prop("Color") == "Green, White", "-greencircle- -whitecircle-", if(prop("Color") == "Green, White, Red, Green", "-greencircle- -whitecircle- -redcircle-", "")))))))))

Replace "-whitecircle-" with the white icon.
Replace "-redcircle-" with the red icon.
Replace "-greencircle-" with the green icon.

In this example you will check if the color is White, if it is White and Red, if it is White and Red and Green to show exactly those combinations, the same starting with Red and the same starting with Green.

You need to extend it to use all the combinations possible and using White as an example you need the following to check the combinations.

if color = white: white icon
if color = white, red: white and red icons
if color = white, green: white and green icons
if color = white, red, green: white, red and green icons

You will need to do this but for the six colors and all the combinations you want to check. You will en up with more than 100 combinations using 6 colors.

Please log in or register to answer this question.

...

Welcome to Notion Answers, where you can ask questions and receive answers from other members of the community.

Please share to grow the Notion Community!

Connect