Great idea and list from Todd Shackelford over at CAD Shack about formulas.....
Revit Family Formula Examples and Tricks
IF (Length < 30′, 2′ 6″, 4′)
If the Length parameter is less than 30' x = 1 , y = 22'-6"
If the Length parameter is greater than 30' this parameter will have a value of 4'-0"
IF that Returns a String
IF (Height > 30′, “This thing is tall”, “This thing is short”)
If the Height parameter is greater than 30' this parameter will return This thing is tall
If the Height parameter is less than 30' this parameter will return This thing is short
Nested IF Statements
IF (Length < 35’, 2′ 6″ , IF (Length < 45′, 3′ , IF (Length < 55′, 5′, 8′ ) ) )
If Length is less than 35', this parameter will have a value of 2'-6"
If Length is between 35' and 45', this parameter will have a value of 3'
If Length is between 45' and 55', this parameter will have a value of 5'
If Length is greater than 55', this parameter will have a value of 8'
IF applied to a Yes/No condition
Length > 40'
If Length is greater than 40' the the statement is true and the Yes/No check box is checked
If Length is 40' or less the statement is false and the Yes/No check box is NOT checked
IF (OR (A = 1 , B = 3 ) , 10 , 5)
If A = 1 or B = 3 this parameter will have a value of 10
If A is not = 1 and B is not = 3 this parameter will have a value of 5
IF (AND (x = 1 , y = 2), 8 , 3 )
If x = 1 and y = 2 this parameter will have a value of 8
If x is not = 1 or y is not = 2 this parameter will have a value of 3
Some Formula Tricks of the Trade
This or That only with a Yes/No parameters
By specifing that metal can not be true while Wood is true the user can only specify one of the two materials. They both can not be checked at the same time. This can be used for visibility where a left or right access panel may be required but never both.
Pick One and Only One
"Don't Change Me Bro"
Swapping Nested Families
In a bookcase family with a nested shelf family, follow these steps to add a parameter that will allow the user to switch from one type of shelf to another.
1. Open the original shelf family and save it as the second shelf option. Add something to make it different.
3. In the Family Types dialog create a new Type parameter named “Swappable Shelf”. Make its discipline Common, its Type of Parameter and group it under Constraints.
4. When you select the Type of Parameter Revit will open the Select Category dialog. Pick Generic Models.
5. Select the original shelf in the bookcase family now. In the Properties dialog, look for the Label parameter and change it to “Swappable Shelf”.6. In the Family Types dialog Create 2 shelf types, Shelf Type 1 and Shelf Type 2. Associate the swappable shelf parameter with the appropriate type.
7. Flex the family. Change the family type and verify that the shelf changes.