Revit Formulas – Everything you need to know

Revit formulas are a dynamic tool for managing parametric elements within a model. When working on families, you most likely encounter situations where formulas become essential and beneficial. While some formulas are straightforward and user-friendly, there are also more advanced ones to explore.

Revit allows the use of formulas in dimensions and parameters, which can be used to control and drive the content within the model. Moreover, it allows us to use conditional statements in formulas to define actions depending on other parameters.

In this article, we will look at what formulas are available in Revit and how to use them. Furthermore, I will give some tips and workarounds about using formulas in families and in the main model.

Formulas Revit

In Revit, it is possible to use formulas in dimensions to control and drive parametric content in a model such as families. Also, conditional statements are allowed in formulas, which you can use to define actions depending on the outcome of other parameters.

Revit has a lot to offer regarding valid formula syntax and abbreviations. The formulas support the common arithmetic operations (+, -, etc) and trigonometric functions (tan, cos, etc). When you use conditional statements, Revit enters parameter values based on whether the condition criteria are satisfied.

revit formulas
Example of Revit Formulas

Formula Syntax and Abbreviations

Revit has a standard list of valid operators you can use in formulas. Note that the examples in this article demonstrate the utilization of integers, decimals, and fractional values with standard mathematical notations.

Note

In Revit, the parameter names are case-sensitive when using formulas. If you use a lowercase letter when a capital letter is required, Revit will indicate that you are not using a valid parameter.

Operators

In the table below, you can find a list of valid operators to use in Revit Formulas.

Function SyntaxDescriptionExample
+Addition, combines two or more numbersHeight = Height_1 + Height_2
-Subtraction, find the difference between two or more numberTotal Length = Length_1 - Length_2
*MultiplicationArea = Width * Height
/DivisionArray = Length_1 / Length_steps
^Exponentiation, (X)^NNumber_parameter ^ 3
sqrt()Square Rootsqrt(25)
List of operators you can use in Revit formulas

The screenshot shows you an example of using a custom “Area” parameter by creating a formula that multiplies “Width” by “Height” using the * operator.

standard revit formulas

Trigonometric Formulas Revit

You can access a comprehensive list of formulas that are specifically to be used in trigonometry in Revit. Note that, the triangle at least has one vertex with a right angle (90 degrees). In addition to the trigonometric syntaxes, you can also utilize the square root operator (sqrt) for the Pythagoras formula.

trigonometric
Function SyntaxDescriptionParameters knownExample
sin()Sinec, Aa = c * sin(A)
asin()Arcsinea, cA = asin(a / c) or b = sqrt(c ^ 2 - a ^ 2)
cos()Cosinec, Ab = c * cos(A)
acos()Arccosineb, cA = acos(b / c) or a = sqrt(c ^ 2 - b ^ 2)
tan()Tangenta, Bb = a * tan(B)
atan()Arctangenta, bA = atan(a / b) or c = sqrt(a ^ 2 + b ^ 2)
List of Trigonometry syntaxes

In the screenshot below, you can see an example of using various trigonometric formulas. There are numerous ways to combine these formulas to suit your specific requirements. These formulas can be useful for angled families, such as dormers, skylights, etc.

trigonometric formulas revit

Other Formulas

In the “Other” category, you will find various syntaxes for different purposes. While most of the syntaxes in this table are less commonly used, the exception is the Pi (π) syntax. Pi (π), is useful when working with circles in families and you like to calculate the area or circumference for example.

Function SyntaxDescriptionExample
log()Logarithm is the inverse function to exponentiation.3 =log(1000) / 10 ^ 3
exp(x)Mathematical constant e raised to the power of x. Where e is Euler’s number (2.71828…).exp(3) / 2.71828 ^ 3
ln()The natural logarithm is the logarithm of a number with the base e, where e is the mathematical constant. This is also the inverse of exp(x) function.ln(x*y) = ln*x + ln*y
abs()Absolute Value (modulus) is the distance a number is away from 0. It’s always a positive value.abs(-3.7) = 3.7
pi()Pi is a mathematical constant representing the ratio of a circle’s circumference to its diameter.Circle Area = pi() * R^2
Circumference = pi() * D(iameter)
Circumference = pi() * (R(adius) * 2)
List with other formulas in Revit you can use

The next example shows the pi() formula used to calculate the area and circumference of a circle. Also, you can notice some of the less commonly used formulas in Revit and how you can implement them. Note that, combining multiple formulas in Revit is possible.

formulas

Rounding Formulas

When dealing with numbers, integers, and currency parameters in Revit, you can instantly apply the available rounding formulas. However, rounding Areas, Lengths, etc take another method which is a workaround in Revit.

Function SyntaxDescriptionExample
round(x)This function returns the value rounded to the nearest whole number, without considering the direction, whether up or down.round(2.2) = 2
round(2.5) = 3
round(-2.4) = -2
round(-2.8) = -3
roundup(x)Returns the value to the largest integral value greater than or equal to x.roundup(2) = 2
roundup(2.2) = 3
roundup(-2.4) = -2
roundup(-2.8) = -2
rounddown(x)Returns the value to the largest integral value less than or equal to x.rounddown(2) = 2
rounddown(2.2) = 2
rounddown(-2.4) = -3
rounddown(-2.8) = -3
List with rounding formulas in Revit

There are many ways to use the rounding formula in Revit, even when it is combined with another formula, like round((number_1 + number_2) / (number_3 - number_4)), for example.

round formulas revit

The challenging part of rounding comes in when you want to use this for Area and Length parameters as this is natively not available in Revit. You get noticed by an “Inconsistent Units” warning. However, as I mentioned before, there are some workarounds to still make this possible.

You can use the formulas in the list below to round(x), roundup(x), and rounddown(x) for Areas and Lengths:

  • Area: round(Area / 1 m²) * (1 m² / 1) where the value 1 m² stands for the decimal, and is adjustable to your requirements. For example: round(Area / 0.1 m²) * (0.1 m² / 1) which round to the nearest whole 0.1 m² decimal.
  • Length: round(Length / 1000 mm) * (1000 mm / 1) where the value 1000 mm stands for the decimal, and you can adjust it according to your requirements.

Last but not least, it is also possible to round to the nearest value you like. For example, you have a parameter with a value of 4.75 and it has to be rounded to the nearest value of 2. In this case, the formula looks like: round(4.75 / 2) * 2) where the outcome is 4.

workaround rounding parameters

Tip

It’s recommended to use an underscore “_” between parameter names instead of the hyphen-minus “-“, because Revit won’t recognize it as a valid parameter name. If you still like to use the hyphen-minus, then place the parameter name between angle brackets [], for example [Length-A] + [Length-B].

Conditional Statements

Conditional statements in Revit are likely the most useful type of formula you will encounter. You can use these formulas for almost every situation. Conditional statements also allow you to use almost every type of parameter in combination with conditional operators.

Conditional Statement uses this structure: IF(<condition>,<result true>,<result false>). In simpler terms, if the condition criteria are met, it turns the true value; otherwise, it turns the false value. Note that, Conditional statements can contain Yes/No parameters, numeric values, and parameter names.

Conditional Operators

The list below contains supported conditional operators you can use in Revit Formulas.

  • < Less than
  • > Greater than
  • = Equals to
  • AND All conditions are true or false
  • OR One of the conditions is true or false
  • NOT Condition is false

Note

Conditional operators such as less than or equal to <=, or greater than or equal to >= are not supported in Revit. In this case, you can use the NOT operator. For example, a <= b should be entered as NOT(a > b).

Conditional Formulas in Revit

Now that you know what operators are available, we can continue by implementing them into some conditional formulas. In the list below I outlined some of the formulas that use conditional statements.

  • Standard IF statement: IF(Height_1 > 1500 mm, 500 mm , 250 mm)
  • IF statement with Yes/No condition: Height_1 > 2300 mm. This returns the checkbox true if the Height_1 parameter is greater than 2300 mm.
  • IF Statement with string (text): IF(Width_1 < 1100 mm, "Door A" , "Door B")
  • IF combined with logical AND: IF(AND(a = 5, b = 10),<result true>,<result false>). The output returns true, if both a = 5, and b = 10, else false.
  • IF combined with logical OR: IF(OR(a = 5, b = 10),<result true>,<result false>). The output returns true, if either a = 5, or b = 10, else false.
  • Nested IF statements: if(Width_1 < 500 mm, 50 mm, if(Width_1 < 1000 mm, 500 mm, if(Width_1 < 1500 mm, 1000 mm, 1500 mm))). This formula turns 50 mm if Width_1 is less than 500 mm, 500 mm if it is less than 1000 mm, 1000 mm if it is less than 1500 mm, and 1500 mm if Width_1 is greater than 1500 mm.
conditional formulas revit

It is possible to use conditional statements in a variety of ways. You can also combine these formulas to create more complex expressions, such as using IF, AND, and OR simultaneously. However, it is important to remember that when doing so, you need to position the parentheses correctly.

Tips & Tricks for Formulas Revit

Lastly, here are some additional tips and tricks to enhance your use of formulas in Revit.

  • You can force values, text, and Yes/No parameters by using the Formula column in the Family Types editor. For numbers, integers, etc. simply fill in a value in the Formula column. For text, enclose it within quotes: "text". For Yes/No parameters use the formula 1 < 2 to check, and 1 > 2 to uncheck. Note that the values become greyed out and cannot be changed in the Value column.
  • To show an inch mark with a quote (“) within a formula, you can bypass it by using a backslash “\” just before the quote: "12\""
force values
  • It is possible to use formulas in schedules by using the Calculated Parameters function. You can read more about this in this article: How to Create Revit Schedules – Basic Guide.
  • You can move model objects or annotations with formulas and different units. First, select an object, select the Move tool, and enter a formula starting with the equal (=) operator. For example, = 400 + 900 mm or = 3 * 4". In this case, it doesn’t matter which primary units are used in the project.
moving objects with formula
Moving objects with formulas and different units
  • In Revit, various operators allow for dynamic element creation, such as a Circular segment. I needed to create a dynamic brickwork arc family with parameters I could reuse for other projects. In this case, the formula to calculate the Radius: R = (h / 2) + ((c ^ 2) / ( 8 * h)) was valuable, which also shows the boundless capabilities of using formulas in Revit.
revit formula for circular segment
Circular segment formula used in an arc brickwork family

Wrapping Up

In Revit, formulas play a crucial role in managing parametric and dynamic elements within a model. These formulas can be especially helpful when creating families. With a variety of valid syntax options in Revit, your creativity can be used to create formulas that effectively control families and their output.

Revit users often use conditional statements to control families in their projects. These conditional statements enable you to define an action based on the state of other parameters. While many formulas are easy to understand, you can try to use more complex ones, so don’t hesitate to experiment.

I hope this article helped you to learn what formulas in Revit are available, and how to use them. Feel free to leave a comment if you have any questions, tips, or tricks I did not mention.

Get more stuff like this

Revit, Dynamo, Sketchup and BIM Tips

I hate spam too, so you can unsubscribe at any time.

Leave a Comment

0 Shares
Tweet
Share
Share
Pin