    1. Login to Give a bone

## Formula Question

Ok, I'm still rather new to labels and formulas.
What I want is to have a Height Label that allows the user only a limited range.
If I knew what I was doing it would look like the following:
Height=>17 or <19.
Another might be:
Length = >36 or <42.
How would I write these formulas?

Thanks.  Reply With Quote

2. Login to Give a bone

## Re: Formula Question

Here's an option to use:  Reply With Quote

3. Login to Give a bone

## Re: Formula Question

could you explain a little bit more.
what's text cal for ? and what's the 1,0 at the end of formula for ?
Best wishes  Reply With Quote

4. Login to Give a bone

## Re: Formula Question

This should do the trick. Make sure that Condition is the parameter that actually contolling your Height length.  Reply With Quote

5. Login to Give a bone

## Re: Formula Question

Wow it is neat to see these formulas! My question for Elmo is why does "Height" have to go at the end of the formula? But this would illustrate my confusion on formulas... so let me ask this:

is there a source to share this really useful syntax info? Is there a Formulas How-To, or tutorial somewhere? I have not been able to get as advanced as these If Then statements without any precedents. How did you all figure it out? Is this just Programming 101 that I am missing?

Nice work.  Reply With Quote

6. Login to Give a bone

## Re: Formula Question

Goto Revit Help and search for "Conditional Statements in Formulas" and "Valid Formula Abbreviations". Also see:

http://revitoped.blogspot.com/2005/1...p-my-mind.html  Reply With Quote

7. Login to Give a bone

## Re: Formula Question Originally Posted by Cheuk Ling
could you explain a little bit more.
what's text cal for ? and what's the 1,0 at the end of formula for ?
Best wishes
The 1,0 are the values that Revit will use if the conditions are met or not.

IF (<condition>, <result-if-true>, <result-if-false>)

In this case, the 1 is the <result-if-true> and the 0 is the <result-if-false>

In the example:

=if(and(Height > 17', Height < 19'), 1, 0)

The <condition> is (and(Height > 17', Height < 19') which is evaluating two things, if Height is greater than 17' AND if Height is less than 19'. If that condition is met, then Revit returns the value 1, and if not true Revit returns the value 0.  Reply With Quote

8. Login to Give a bone

## Re: Formula Question

To explain Elmo's...

Height = value you want to control
Condition = formula based on Height's value, assigned to the dimension as its parameter

To break down the formula...

if (Height < 17', 17', if (Height > 19', 19', Height))
If the value of Height is less than 17', make the value of Height 17'. So if the user puts in 16' for the height, it will change it to 17'.

If the value of Height is more than 19', make the value of Height 19'. So if the user puts in 20' for the height, it will change it to 19'.

If the value of Height is between 17' and 19', it retains its value. So if a user puts in 18', the value of Height stays at 18'.  Reply With Quote

9. Login to Give a bone

## Re: Formula Question

Thanks David, the Help file strikes again. Man, I wish I could just quit my job and study the help file for a month or so. I think I could learn a ton!

Anyone want to finance me? [grin]

In the meantime, the other REVIT users are providing some great feedback on the formulas. Thank you. however, you all have not really answered my question which is why does the word Height appear at the end of the formula. I get the IF this, THEN that part of the formula. But what is the last slot say Height again?

Thanks again. This has been quite helpful. As a reward you can all take the rest of the day off. Tell 'em I said so.  Reply With Quote

10. Login to Give a bone

## Re: Formula Question

The Height at the end is <result-if-false> This is a Nested Conditional formula. It's really a "double IF" statement. If THIS or IF THAT, then do THIS-HERE, if not either, then just give me the Height. Here's the breakdown:

if (Height < 17', 17', if (Height > 19', 19', Height))

First: Height < 17', 17', First, check if Height is less than 17', if so, then return the Value 17'
Next: if (Height > 19', 19', if Height is not less than 17', then check the next expression, which is to see if Height is greater than 19' feet...if it is, return the value 19'
Finally: Height)) If neither of those expressions is true, the Height at the end will return the Actual Height value.

Less than 17', return 17 feet. Greater than 19', return 19'. If between 17' and 19', return the value defined as Height, which could be any value in between.

Make sense?  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•