Revit Lookup Tables
What are Lookup Tables in Revit?
Lookup tables are used to define parameter values based on another parameter value in the family, hence the name, lookup table. Lookup tables are defined in an external CSV file. So essentially what is happening is you tell Revit to go look at the table in the CSV file and return a value for a parameter based on a value define in another column.
Traditionally, lookup tables have been used for pipe and conduit fittings. More recently, they are being used for other categories of families. They provide a different functionality than just using formulas. Lookup tables allow for quick population of instance parameters without having to manage multiple family types. They are different than type catalogs. Type catalogs are used to define family types for a specific family whereas the goal with lookup tables is to reduce the number of types needed.
Lookup Table Examples
Let’s start with the original purpose of lookup tables to better understand how they work. With pipe and conduit, there are nominal diameters as well as inside (ID) and outside diameters (OD). For example, if you were working with schedule 40 PVC pipe, you could find a table like the one below from a pipe manufacturer. Most of the time, there is not a simple formula that can be used to calculate the OD and ID based on the nominal size.
You could create a separate type for every single nominal size, but that would get out of hand really fast! For these reasons, lookup tables are used in Revit. That way the data from the manufacturer can be input into a CSV file and then “looked up” based on the nominal size. It doesn’t have to be just OD and ID. You can input and lookup several other parameters based on the nominal size.
Lookup tables can be used with any family category, but that does not necessarily mean they are useful for every category. Recently I have found applications for lookup tables with various types of equipment families. For example, with mechanical equipment, you can have the same model and some of the parameter values vary slightly. The airflow can be different based on the static pressure from the ductwork, the fan speed may be different depending on the space it is serving, and so on. A lot of times mechanical designers will have an Excel file from the equipment manufacturer with all of these parameter values. So, an easy solution is to put that data into a CSV file and create a lookup table.
CSV File Format
The first row in the CSV file is for header information. You must use specific formatting for the header cells. Additionally, Revit does not use the first column when searching for a lookup value. The information in the first column should be informative to you and other users to make sense of the information.
Header Cell Format:
Acceptable parameter types are: NUMBER, LENGTH, AREA, VOLUME, ANGLE, and OTHER.
Here is the formatting for the schedule 40 PVC pipe table shown above.
Family Formula Syntax
The size_lookup function can be used in the Formula field for a family parameter. Here is the syntax for the size_lookup function based on one lookup value:
size_lookup(LookupTableName, “LookupColumn”, DefaultIfNotFound, LookupValue)
LookupTableName: This is the name of the CSV file used as the lookup table. Be aware that the file must be imported into the family for it to be recognized. In the Family Types dialog, click Manage Lookup Tables to check. You can also use a parameter name for this value and then enter the CSV file name into the parameter.
LookupColumn: This is the name of the column in the CSV file that you want the result value to come from. In other words, this is the column where the parameter value will come from. Also, make sure you enter the column name in quotation marks. Going back to the schedule 40 PVC example, if you where using the size_lookup function for the Outside Diameter parameter, then you would enter “Outside Diameter” so that Revit would look in column C.
DefaultIfNotFound: This is the parameter value that will be used if the LookupValue is not found. This can be a single value or a formula based on other parameters.
LookupValue: This is the value you want Revit to look for in the CSV file. You can enter an explicit value or a parameter name. Revit will skip the first column and begin looking for the value in the second column. If the value isn’t found, Revit will look in subsequent columns of the table. If the value is found, then Revit will return the value in the row from the LookupColumn. Once again, in our schedule 40 PVC example, you would enter Nominal Diameter.
Putting it altogether, in the family you would have a Nominal Diameter parameter as well as parameters for Outside Diameter and Inside Diameter. Here are the formulas you would use:
Outside Diameter Formula: size_lookup(LookupTableName, “Outside Diameter”, Nominal Diameter, Nominal Diameter)
Inside Diameter Formula: size_lookup(LookupTableName, “Inside Diameter”, Nominal Diameter, Nominal Diameter)
Take note that you would also need a parameter called LookupTableName and the value would have to match the lookup table name. Also, in the above size_lookup formulas, if a value was not found, the Nominal Diameter value would be used due to Nominal Diameter being input into the third criteria.
Family Formula Syntax for Multiple Lookup Values
You can also use the size_lookup function with multiple lookup values. With multiple lookup values, each one must be found in the same row for Revit to return the value in the LookupColumn. Here is the syntax for multiple lookup values:
size_lookup(LookupTableName, “LookupColumn”, DefaultIfNotFound, LookupValue1, LookupValue2, …, LookupValueN)
Lookup tables allow for quick population of instance parameters without having to manage multiple family types. Typically lookup tables have been used for pipe and conduit fitting families, but they have uses for several other categories of families!