Skip to content

Lookup Another Table

Let’s write one of the most common formulas — performing a lookup to another table.

XLOOKUP

The function for performing a lookup in Tabmega is XLOOKUP. Excel and Google Sheets have several ways of performing lookups, including VLOOKUP, INDEX/MATCH, and more recently the XLOOKUP function. Once Excel users learn the XLOOKUP function they usually find it the easiest and most intuitive way of performing lookups. See this Reddit thread for proof. As a result, Tabmega only supports XLOOKUP so users only need to worry about learning one lookup method instead of three.

Performing lookups

  1. If you are following along with the MovieLens 25M dataset from the Tutorial Setup, go to the ratings table. Click on the column to the far right with the + button. If you like using the keyboard instead of the mouse, you can navigate to the button with the arrow keys and it will have the same effect. screenshot

  2. Name the new column movieTitle. screenshot

  3. Start editing the formula for the cell in row 1. The beginning of the formula will be =XLOOKUP(. Feel free to use the autocomplete. screenshot

  4. For the first argumnet, Use the mouse or keyboard to select the movieId column as the first argument. screenshot

  5. Add a , to start the second argument. Use the mouse or keyboard to select the movieId column in the movies table. This requires switching tabs while editing the formula. If you like Keyboard Shortcuts for switching tabs, they are the same as Excel and Google Sheets. screenshot

  6. Add a , to start the third argument. For the third argument, use the mouse or keyboard to select the title column in the movies table. screenshot

  7. Hit the Enter key to finish the formula and get ready to apply. screenshot

  8. Click the Apply button. This lookup calculation may take a few seconds depending on your computer. You’ll see the Processing dialog while it’s running. screenshot screenshot

  9. Perform the same steps as above to add a new column that’s a lookup to the is comedy? column that we calculated in Add Columns and Formulas using movieId again. The end result should look like below. screenshot

Hint: the formula you’ll want is =XLOOKUP(ratings.movieId, movies.movieId, movies.'is comedy?')