40% OFF! — Limited Time Offer
← Back to Articles

December 22, 2025

·By El Alaoui Mohamed

Revit Lookup Tables: Replace Nested IFs With Clean CSV Logic (Complete Tutorial)

Revit lookup table tutorial — replace nested IF with CSV

TL;DR

A Revit lookup table is a CSV file that replaces nested IF chains. Instead of seven levels of nesting, you write one size_lookup() formula that reads from a spreadsheet. The CSV is embedded in the family on import. The five most common mistakes: wrong delimiter, hidden spaces in headers, missing blank first cell, wrong type notation, and saving as XLSX instead of CSV.

Key Takeaways

  • A lookup table replaces nested IF chains — one size_lookup() formula references the entire CSV.
  • CSV header format is strict: blank first cell, ColumnName##type##unit for every output column.
  • size_lookup() takes 4 arguments: filename, input parameter, output column name, default value.
  • The CSV is embedded in the family on import — team members do not need the CSV file.
  • After editing the source CSV, you must reimport it — the family does not auto-update.
  • Use lookup tables for arbitrary data (spec sheets); use formulas for mathematical relationships.

Here is a door frame formula that handles seven sizes using nested IF statements:

Frame_Width = IF(Size_Code = "S1", 75mm, IF(Size_Code = "S2", 75mm, IF(Size_Code = "S3", 100mm, IF(Size_Code = "S4", 100mm, IF(Size_Code = "S5", 125mm, IF(Size_Code = "S6", 125mm, IF(Size_Code = "S7", 150mm, 150mm)))))))

Seven levels of nesting. Adding an eighth size means finding the right level inside the chain, inserting the new condition, and recounting parentheses. One mistake anywhere breaks every size.

Here is the same logic as a lookup table formula:

Frame_Width = size_lookup("Door_Catalog.csv", Size_Code, "Frame_Width", 0)

One line. The CSV handles any number of sizes. Adding a new size means opening a spreadsheet and adding a row — no formula editing required.

How Revit Lookup Tables Work

A Revit lookup table is a CSV file defining a relationship between one input value (the key) and one or more output values. When Revit evaluates the formula, it opens the CSV, searches the first column for a value matching the input parameter, reads the value from the specified output column in that row, and returns it.

The CSV is embedded in the family file on import — it travels with the family, so project team members do not need the file on their machines.

The CSV File Structure

The header row is the critical part — it tells Revit what type of data each column contains.

Header format: ColumnName##type##unit

The first cell of the header row must be blank. Every subsequent column uses the type notation:

Data typeHeader syntax
Text / key column##other##
Length (mm)##length##millimeters
Length (m)##length##meters
Angle (degrees)##angle##degrees
Unitless number##number##
Yes/No##yesno##

The size_lookup() Function — 4 Arguments

size_lookup("filename.csv", input_parameter, "output_column", default_value)
ArgumentDescription
"filename.csv"Exact filename of the imported CSV — case-sensitive, with .csv extension, in quotes
input_parameterThe parameter whose value is used as the key — no quotes
"output_column"The column name from the CSV header — without the ##type## suffix — in quotes
default_valueValue returned if the input does not match any row in the CSV

Complete Worked Example: Door_Catalog.csv

This example drives Door Width, Height, Frame Depth, and Frame Width from a single Size_Code text parameter.

Step 1 — Create the CSV file

Open a plain text editor (TextEdit on Mac, Notepad on Windows — not Excel) and write:

,Width##length##millimeters,Height##length##millimeters,Frame_Depth##length##millimeters,Frame_Width##length##millimeters S1,762,2032,150,75 S2,813,2032,150,75 S3,864,2134,150,100 S4,914,2134,150,100 S5,1000,2200,175,100 S6,1067,2200,175,125 S7,1200,2400,200,125 S8,1500,2400,200,150

Save as Door_Catalog.csv. Verify the extension is .csv, not .txt or .xlsx.

Step 2 — Import into the family

  1. Family Editor → Family Types (shortcut: FT)
  2. Click Manage Lookup Tables at the bottom
  3. Click Import → select Door_Catalog.csv
  4. Click OK — the CSV is now embedded in the family

Step 3 — Write the lookup formulas

Door_Width = size_lookup("Door_Catalog.csv", Size_Code, "Width", 900mm) Door_Height = size_lookup("Door_Catalog.csv", Size_Code, "Height", 2100mm) Frame_Depth = size_lookup("Door_Catalog.csv", Size_Code, "Frame_Depth", 150mm) Frame_Width = size_lookup("Door_Catalog.csv", Size_Code, "Frame_Width", 100mm)

Step 4 — Test it

Set Size_Code to S1 and verify Width = 762, Height = 2032. Test S4, S7, and a value not in the CSV (e.g., S9) to confirm the default fires correctly.

Updating values later

Revit embeds a snapshot of the CSV at import time. If you later edit the source CSV on disk, the family does not automatically update. To update: Manage Lookup Tables → Delete old table → Import updated file.

Go deeper

Chapter 9: CSV Lookup Tables — Full Walkthrough

Includes interpolated numeric key examples, manufacturer CSV imports, debugging strategies, and a downloadable door catalog template. 40% off at $18.

5 Common CSV Formatting Mistakes

Mistake 1

Wrong Delimiter

Problem: Some regional versions of Excel default to semicolons (;) instead of commas. Revit expects commas only.

Fix: Open the file in a plain text editor to verify. If you see semicolons, replace them all with commas before importing.

Mistake 2

Hidden Spaces in Headers

Problem: A header like 'Width ##length##millimeters' (space before ##) causes Revit to fail recognising the column, returning the default value for every row.

Fix: The ## must follow the parameter name with no space. Verify headers in a plain text editor, not Excel.

Mistake 3

Missing Blank First Cell

Problem: The first row starts with a column name instead of an empty cell. Revit cannot parse the file and rejects the import.

Fix: The first character of the CSV file must be a comma. In raw text: ,Width##length##millimeters,...

Mistake 4

Wrong Type or Unit Notation

Problem: Using ##mm## or ##LENGTH## (wrong abbreviation or case) instead of ##length##millimeters. Revit is case-sensitive in header parsing.

Fix: Use exact notation: ##length##millimeters, ##angle##degrees, ##number##, ##other##, ##yesno##. All lowercase.

Mistake 5

Saving as XLSX Instead of CSV

Problem: Revit cannot read .xlsx files at all. BOM-encoded CSV sometimes imports but with corrupted data in the first cell.

Fix: In Excel: Save As → CSV UTF-8 (Comma delimited). Then verify in a text editor before importing.

When NOT to Use a Lookup Table

  • The relationship is mathematical. Width = Height * 0.5 is cleaner as a formula than a table.
  • Fewer than four variations. A 3-option nested IF is still readable. The CSV overhead is not worth it for small sets.
  • Data changes frequently on-site. If edited daily by non-BIM staff, a CSV introduces risk. Use a shared parameter instead.
  • You need to compare two live parameters. Lookup tables return from a static table — for IF(Width > Height, ...) conditions, use an IF formula.

For context on when to choose lookup tables vs. nested IF statements, see the Revit IF statement tutorial. For errors that can occur in lookup formulas, see why your Revit family formula isn't working.