Is it possible to write an IF/THEN formula for this situation?

Is it possible to write an IF/THEN formula for this situation?

Sahay_R
Mentor Mentor
2,184 Views
9 Replies
Message 1 of 10

Is it possible to write an IF/THEN formula for this situation?

Sahay_R
Mentor
Mentor

Hell Revit Community,

 

I am attempting to write a formula  that looks at ranges of values instead of a single value - 

 

IF parameter A is 4"-21", THEN parameter A1 = 3"

IF parameter B - 21.5"-23", THEN parameter B1 = 4"

IF parameter C = 21.5"-25", THEN parameter C1 = 5"

 

Thank you!

Rina


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
0 Likes
Accepted solutions (2)
2,185 Views
9 Replies
Replies (9)
Message 2 of 10

barthbradley
Consultant
Consultant
Accepted solution

you mean: A1 =if (and(A > 0' 4", A < 1' 9"), 0' 3", 0')? 

 

What's A1 if False? 0"?  

Message 3 of 10

martijn_pater
Advisor
Advisor
Accepted solution

hmmm I'm thinking maybe something like... 
A1 --> formula :
IF ( AND (A >4" , A< 21"), 3", <else>)

B1 --> formula : IF ( AND (B>21.5" , A< 23"), 4", <else>)

C1  --> formula : IF ( AND (C >21.5" , A<25"), 5", <else>)

or perhaps something for lookup table?

Message 4 of 10

barthbradley
Consultant
Consultant

Seriously @Sahay_R ??? 

Message 5 of 10

Sahay_R
Mentor
Mentor

What about this 

 

IF parameter A is 4"-21", THEN parameter A1 = 3"

IF parameter A - 21.5"-23", THEN parameter A2 = 4"

IF parameter A = 21.5"-25", THEN parameter A3 = 5"


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
Message 6 of 10

Sahay_R
Mentor
Mentor

.


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
Message 7 of 10

ToanDN
Consultant
Consultant

@Sahay_R wrote:

What about this 

 

IF parameter A is 4"-21", THEN parameter A1 = 3"

IF parameter A - 21.5"-23", THEN parameter A2 = 4"

IF parameter A = 21.5"-25", THEN parameter A3 = 5"


Are you sure about those?  What if A is out-of-range?

0 Likes
Message 8 of 10

RDAOU
Mentor
Mentor

Something odd about those formulas...are all those parameters in 1 project? if they are, and Parameter A (which I suppose has a unique value) is driving 3 different parameters A1, A2 and A3, what happens to A2 and A3 when the first condition/if statement  is satisficed? same when the second and 3rd IFs are satified!

 

Nest the If/Then statements is such case would be more logical … I think

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


0 Likes
Message 9 of 10

Sahay_R
Mentor
Mentor

Sorry about that, @ToanDN - I clacked when I should have clicked!

You are right - it should have been 

IF parameter A is 4"-21", THEN parameter A1 = 3"

IF parameter A - 21.5"-23", THEN parameter A2 = 4"

IF parameter A = 23.5"-25", THEN parameter A3 = 5"


Rina Sahay
Autodesk Expert Elite
Revit Architecture Certified Professional

If you find my post interesting, feel free to give a Kudo.
If it solves your problem, please click Accept to enhance the Forum.
0 Likes
Message 10 of 10

martijn_pater
Advisor
Advisor

Just a few comments/questions:) First you are not really writing down ranges [x,y] mathematically here, second you haven't provided a definition of <else> for A1/A2/A3 if your condition in your if statement returns false ie. if it falls outside of this range, third is that parameters A1/A2/A3 can test for the same condition and return values accordingly... Perhaps you could elaborate on what you were trying to make here.

As you've written it down (is/-/=), it's something like A1=3" if A=-17", A2=4" if A is a rational number (lenght/number?)/always true?, A3=5" if A=-1.5" 🙂 So I'm going to assume that's not what you meant. ^^ But actually if you want to include 4" and 21" in your specified range [4",21"] = 4"A≤21" your formula/conditional statement should look like:
A1 with formula; if(and(not(A < 4"), not(A > 21")), 3", 0")
A2 with formula; if(and(not(A < 21.5"), not(A > 23")), 4", 0")
A3 with formula; if(and(not(A < 23.5"), not(A > 25")), 5", 0")

The formula's posted earlier actually represents the range as (4",21") instead of [4",21"]. Since you haven't specified values for A1/2/3 if A falls outside of these ranges, like barthbradley I've set all of them to 0... But possibly you need it to be something else, that remains unclear...

 

 





0 Likes