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.
Table of Contents
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.
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 (
cos, etc). When you use conditional statements, Revit enters parameter values based on whether the condition criteria are satisfied.
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.
NoteIn 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.
In the table below, you can find a list of valid operators to use in Revit Formulas.
|Addition, combines two or more numbers|
|Subtraction, find the difference between two or more number|
The screenshot shows you an example of using a custom “Area” parameter by creating a formula that multiplies “Width” by “Height” using the
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.
|Function Syntax||Description||Parameters known||Example|
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.
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.
|Logarithm is the inverse function to exponentiation.|
|Mathematical constant |
|The natural logarithm is the logarithm of a number with the base |
|Absolute Value (modulus) is the distance a number is away from 0. It’s always a positive value.|
|Pi is a mathematical constant representing the ratio of a circle’s circumference to its diameter.|
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.
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.
|This function returns the value rounded to the nearest whole number, without considering the direction, whether up or down.|
|Returns the value to the largest integral value greater than or equal to |
|Returns the value to the largest integral value less than or equal to |
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.
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
rounddown(x) for Areas and Lengths:
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
round(Length / 1000 mm) * (1000 mm / 1)where the value
1000 mmstands 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
TipIt’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 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.
The list below contains supported conditional operators you can use in Revit Formulas.
ANDAll conditions are true or false
OROne of the conditions is true or false
NOTCondition is false
NoteConditional 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 <= bshould 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.
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
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 < 2to check, and
1 > 2to 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:
- 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 mmor
= 3 * 4". In this case, it doesn’t matter which primary units are used in the project.
- 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.
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.