How to Use Formulas in Autodesk Revit: 8 Steps – wikiHow.

1
Learn how to write a formula for exponentiation: use X raised to the power of Y = X ^ Y

2
Learn how to write a formula for E raised to an x power
 E is a mathematical constant that is approximately equal to 2.7. It is an irrational number, but if we truncate it to 20 decimals it would be 2.7182818284590452353.
 Revit usage = exp(x)

3
Learn how to find the circumference and area of a circle with a formula in the program:
 Usage in Revit = pi()
 Circumference = pi() * (Radius * 2)
 Circumference = pi() * Diameter
 Circle Area = pi() * Radius ^ 2

4
Learn how to find Square Roots of any number in this program.
 Fixed value = sqrt(999)
 Parameter = sqrt(Width)
 Formula= sqrt(Width + Height)

5
Learn how to solve logarithm problems.
 The logarithm of a number to a given base is the exponent to which the base must be raised in order to produce that number. For example, the logarithm of 1000 to base 10 is 3, because three factors of 10 must be multiplied to yield a thousand: 10 × 10 × 10 equals 1000
 Revit usage = log(1000)

6
Learn how to force yes/no parameters to be checked or unchecked.
 Force checked = 1 < 2
 Force unchecked = 1 > 2

7
Learn how to solve conditional statements. Conditional statement uses this structure:

 IF (<condition>, <resultiftrue>, <resultiffalse>)
 Supported Conditional Operators
 < Less than
 > Greater than
 = Equal
 / Divide
 AND Both statements are true
 OR One of the statements is true
 NOT Statement is false
 Conditional statements can contain numeric values, numeric parameter names, and Yes/No parameters. Currently, <= and >= are not implemented. To express such a comparison, you can use a logical NOT. For example, a<=b can be entered as NOT(a>b)
 Simple IF Statement
 IF (Length < 900, <true>, <false>)
 Formula That Returns Strings
 IF (Length < 900, “Opening too narrow”, “Opening OK”)
 Using logical AND
 IF ( AND (x = 1 , y = 2), <true>, <false>)
 Returns <true> if both x=1 and y=2, else <false>
 Using logical OR
 IF ( OR ( x = 1 , y = 2 ) , <true>, <false>)
 Returns <true> if either x=1 or y=2, else <false>
 Nested IF statements
 IF ( Length < 500 , 100 , IF ( Length < 750 , 200 , IF ( Length < 1000 , 300 , 400 ) ) )
 Returns 100 if Length<500, 200 if Length<750, 300 if Length<1000 and 400 if Length>1000
 IF with Yes/No condition
 Length > 40
 Returns checked box (<true>) if Lenght > 40
 NOT with Yes/No condition
 not(Viz)
 Returns checked box (<true>) if Yes/No parameter “Viz” is unchecked, and returns unchecked box (<false>) if Yes/No parameter “Viz” is checked.
 IF AND OR Returning the greatest of three values
 Say you have these 3 length parameters, and want a fourth parameter to return the greatest value/length of the 3:
 Length A
 Length B
 Length C
 Return Length (Returns the greatest of the three length parameters)
 Return Length = if(and(or(Length A > Length B, Length A = Length B), or(Length A > Length C, Length A = Length C)), Length A, if(and(or(Length B > Length A, Length B = Length A), or(Length B > Length C, Length B = Length C)), Length B, if(and(or(Length C > Length A, Length C = Length A), or(Length C > Length B, Length C = Length B)), Length C, 0 mm)))
 Another option is to use an extra “Calc” parameter, which is a bit more clumsy but also way easier and more manageable for us mortals.
 Calc = if(Length A > Length B, Length A, Length B)
 Return Length = if(Calc > Length C, Calc, Length C)


8
Learn how to solve a trigonometry problem in the software.
 Known: a+b
 c = sqrt(a ^ 2 + b ^ 2)
 A = atan(a / b)
 B = atan(b / a)
 Known: a+c
 b = sqrt(c ^ 2 – a ^ 2)
 A = asin(a / c)
 B = acos(a / c)
 Known: b+c
 a = sqrt(c ^ 2 – b ^ 2)
 A = acos(b / c)
 B = asin(b / c)
 Known: c + A
 a = c * sin(A)
 b = c * cos(A)
 B = 90° – A
 Known: c + B
 a = c * cos(B)
 b = c * sin(B)
 A = 90° – B
 Known: a + B
 b = a * tan(B)
 c = a / cos(B)
 A = 90° – B
 Known: b + A
 a = b * tan(A)
 c = b / cos(A)
 B = 90° – A
 Known: a + A
 b = a / tan(A)
 c = a / sin(A)
 B = 90° – A
 Known: b + B
 a = b / tan(B)
 c = b / sin(B)
 A = 90° – B
Range of ValuesGiven the following parameters:
user_value:
min_value:
max_value:
actual_value: = if (user_value < min_value, min_value, if (user_value > max_value, max_value, user_value))Specify a range of valid entries, with the min_value and max_value parameters; then, use the actual value if it is within the range; otherwise, use your minimum or maximum values.
Credits: Alfredo Medina, who posted this on March 23rd 2011
Circular Segments.
Here’s how to calculate the Segment length, the Chord Length, the Angle etc. (Image should speak for itself)
 Known: a+b
The formula that drives the number of occurrences of instances of certain element in a family that does not follow a pattern (like emercgency lights in a continuous Led Stripe) could look like this
if(Number of Units = 1, 2, if(Number of Units = 2, 2, if(Number of Units = 3, 2, if(Number of Units = 4, 3, if(Number of Units = 5, 3, if(Number of Units = 6, 4, if(Number of Units = 7, 4, if(Number of Units = 8, 5, if(Number of Units = 9, 5, if(Number of Units = 10, 6, if(Number of Units = 11, 6, if(Number of Units = 12, 7, if(Number of Units = 13, 7, if(Number of Units = 14, 8, if(Number of Units = 15, 8, if(Number of Units = 16, 9, if(Number of Units = 17, 8, if(Number of Units = 18, 10, if(Number of Units = 19, 10, if(Number of Units = 20, 11, if(Number of Units = 21, 11, if(Number of Units = 22, 12, if(Number of Units = 23, 12, if(Number of Units = 24, 13, if(Number of Units = 25, 13, if(Number of Units = 26, 14, if(Number of Units = 27, 14, if(Number of Units = 28, 15, if(Number of Units = 29, 15, if(Number of Units = 30, 16, if(Number of Units = 31, 16, if(Number of Units = 32, 17, if(Number of Units = 33, 17, if(Number of Units = 34, 18, if(Number of Units = 35, 18, if(Number of Units = 36, 19, if(Number of Units = 37, 19, if(Number of Units = 38, 20, if(Number of Units = 39, 20, if(Number of Units = 40, 21, if(Number of Units = 41, 21, if(Number of Units = 42, 22, if(Number of Units = 43, 22, if(Number of Units = 44, 23, if(Number of Units = 45, 23, if(Number of Units = 46, 24, if(Number of Units = 47, 24, if(Number of Units = 48, 25, if(Number of Units = 49, 25, if(Number of Units = 50, 26, 2))))))))))))))))))))))))))))))))))))))))))))))))))