Expand my Community achievements bar.

SOLVED

Calculated field from multiple IF/OR statements

Avatar

Level 3

I am trying to create what I thought was a simple nested IF statement calculation to populate one choice if one or more options of a multi-select field are selected, another is displayed if different options are selected and both are displayed if there is overlap.  The quick example I started with is below. I'm not sure if the OR operator is the correct choice or if I'm even going in the right direction here.  I realize that there isn't a "false" value on these and maybe that's part of it, but I have tested it without success. 

IF({DE:Deliverable Type}="Autoship","Marcomm"||IF({DE:Deliverable Type}="Blog","Marcomm"||IF({DE:Deliverable Type}="Brand Design","Marcomm"||IF({DE:Deliverable Type}="Packaging","Ecomm"))))
 
So, if one or more of the first three IFs are true, I want the calcuation to indicate Marcomm.  If the last is true, I want it to say Ecomm.  If any of the first three and the last one are true, I want it to say both.  There are several more I need to add to this, but this is my starting point and it's not working as I'd hoped.
 
I also attempted this...
IN({DE:Deliverable Type},"Autoship","Blog","Brand Design","Conference","Direct Mail and Print","Email","Gift Card Product Development","Performance Marketing","Site","Social","TV/YouTube", "Marcomm",""||IN({DE:Deliverable Type},"National Brands ePDP","National Brands PDP","Packaging","Private Brand PDP/ePDP", "Ecomm", ""))
 
Now I think I'm just confusing myself.  Any ideas?  Thanks in advance.
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

IF({DE:Deliverable Type}="Autoship"||{DE:Deliverable Type}="Blog"||{DE:Deliverable Type}="Brand Design","Marcomm",IF({DE:Deliverable Type}="Packaging","Ecomm"))

I think the above will get you what you need.  It's saying Deliverable Type can = Autoship OR Blog OR Brand Design and if any are true make the field say Marcomm.  IF type is Packaging and true then make it Ecomm.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

IF({DE:Deliverable Type}="Autoship"||{DE:Deliverable Type}="Blog"||{DE:Deliverable Type}="Brand Design","Marcomm",IF({DE:Deliverable Type}="Packaging","Ecomm"))

I think the above will get you what you need.  It's saying Deliverable Type can = Autoship OR Blog OR Brand Design and if any are true make the field say Marcomm.  IF type is Packaging and true then make it Ecomm.

Avatar

Community Advisor

You could also try a IFIN statement to bundle all those IFs into one array-based IF.

Somethig like:

IFIN({DE:Deliverable Type}="Autoship", "Blog", "Brand Design", "Marcomm", "Packaging", "Ecomm")

 

The rules are:

This expression allows you to look for a specific value in a string of possible values. If the value you are looking for equals one of the provided values, then the

expression returns the trueExpression; otherwise, it returns the falseExpression.

The expression is formatted as follows:

IFIN(value, value1, value2,..., trueExpression, falseExpression)

For example, you can find a specific Project Owner and mark those projects with a specified tag in a project view:

IFIN({owner}.{name},”Jennifer Campbell”,”Rick Kuvec”,”Marketing Team”,”Other Teams”)

In everyday speech, this statement means: “If the Project Owner is Jennifer Campbell or Rick Kuvec, mark this project with ‘Marketing Team’; otherwise, mark it with

‘Other Teams’.”
If you do not want to label the true or false expressions, you must insert a blank label in your statement, such as:

IFIN({owner}.{name},”Jennifer Campbell”,”Rick Kuvec”,””,”Other Teams”)


Or

IFIN({owner}.{name},”Jennifer Campbell”,”Rick Kuvec”,”Marketing Team”,””