Formula using if / or

Formula using if / or

Mike_Sanderson
Enthusiast Enthusiast
756 Views
8 Replies
Message 1 of 9

Formula using if / or

Mike_Sanderson
Enthusiast
Enthusiast

Hi,

 

I am trying to get a value output depending on which yes/no parameter is selected.

It seems fairly simple but I am not quite getting it.

 

In the image attached I have split apart the if formula, so obviously it does not work, but hopefully you get the idea of what I am trying to achieve. 

 

mikePZQMX_0-1668544802194.png

 

 

 

0 Likes
Accepted solutions (3)
757 Views
8 Replies
Replies (8)
Message 2 of 9

mhiserZFHXS
Advisor
Advisor
Accepted solution

Embed the ifs within each other

 

if(Parameter A, 1, if(Parameter B, 2, 3).

 

So the true value for parameter A is 1, and the false value is determined by parameter B. You don't actually need to include Parameter C, as you can just have that value as the result if parameter B is false.

0 Likes
Message 3 of 9

Mike_Sanderson
Enthusiast
Enthusiast
So simple, great thanks.
In addition to this, what is there where 5 parameters?
0 Likes
Message 4 of 9

ToanDN
Consultant
Consultant
Accepted solution

I would add 3_Wild Zone_High to the formula to be certain only it gets the value of 30.  If an user enters something other than 1 , 2, 3 then the outcome is 0, not 30.

 

if (1_Wild Zone_Low, 10, (if (2_Wild Zone_Medium, 20, (if (3_Wild Zone_High, 30, 0)))))

0 Likes
Message 5 of 9

mhiserZFHXS
Advisor
Advisor
Accepted solution

Keep embedding if statements.

 

if(Parameter A, 1, if(Parameter B, 2, if(Parameter C, 3, if (Parameter D, 4, 5))))

 

You just need one less parameter than you have values, as the false result in the last if statement can just be whatever the last value is without a parameter tied to it. (My example doesn't have a parameter E, it just has 5 as the last result).

0 Likes
Message 6 of 9

crapai
Advocate
Advocate

I'm not sure if this is because the if statements were split apart but,

 

If statements need to be nested inside themselves so that the next if statement becomes the else of the first. As the last else statement I usually use a value that will indicate that the user hasn't chosen a yes/no parameter. Also keep in mind that this type of formula structure will go with whatever true statement it finds first so if 'a' and 'c' are checked it will read 'b'. If none are checked it will read 'x'.

 

If(a, b, if(c, d, if(e, g, x)))

0 Likes
Message 7 of 9

mhiserZFHXS
Advisor
Advisor

@Mike_Sanderson 

 

Regarding @ToanDN 's response, which is valid, what kind of parameters are these? Are they integers, text, speed etc?I would think having a 0 could be confusing to users other than yourself. If its a text parameter, or can be a text parameter, maybe have the final false statement say "Wind Zone Selection Input Invalid".

 

 

0 Likes
Message 8 of 9

Mike_Sanderson
Enthusiast
Enthusiast

This is mostly a learning exercise for me, so not sure if this will ever actually get used in our office.

The "Wind Zone Selection" is an Integra. I am just playing with some ideas at the moment, so this may not stay.

The Integra is a less complicated way of only ticking 1 yes/no parameter. I have seen that the formula to control only ticking 1 yes/no parameter is very complicated, and way over my skill level. 

 

 

0 Likes
Message 9 of 9

ToanDN
Consultant
Consultant

This is to entertain yourself:

https://www.revitforum.org/node/1126

 

0 Likes