# Lookups

## Overview

Sometimes you will need to lookup a [**Variable**](https://help.taglo.io/variables)'s value based on another Variable's value.

> For instance, let's say we have a Model with four cost categories. For each cost category we want to apply one of two inflation types, RPI or CPI (Retail and Consumer Price Index respectively). We want to be able to dynamically choose between the two options, and for the cost item to use the correct inflation value automatically.

This is achieved using a Lookup reference - we explain how you can achieve this below.

{% hint style="info" %}
This is the kind of operation you typically perform in Excel with an INDEX-MATCH formula, or an [**XLOOKUP**](https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929)
{% endhint %}

## Lookup reference example

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2FFUr5M5V85TYPUDBTj9vr%2Fimage.png?alt=media&#x26;token=0eb68e48-e889-4c66-b4e5-b4374e2a8b99" alt=""><figcaption><p>Example of a Lookup reference</p></figcaption></figure>

This above example illustrates the scenario described in the [**Overview**](#overview). `Recurring cost inflation` pulls its values from `Inflation by type` according to the selected value in `Recurring cost inflation types`.

## Creating the Lookup reference

To create a Lookup reference, perform the following steps, as illustrated in the screenshots below:

1. In the [**Calculation step**](https://help.taglo.io/calculations/the-calculation-page), add a Variable reference to the target Variable <mark style="color:green;">**(1)**</mark> (in the above example `Inflation by type`) using [**any method**](https://help.taglo.io/calculations/calculation-parts/variable-references/..#overview) - by default, the reference will be a Summary of the target Variable, because the target has different [**Dimensions**](https://help.taglo.io/dimensions), so an `Auto` reference is not possible.
2. Edit the Variable Reference Calculation Part that has been added <mark style="color:green;">**(2)**</mark>
3. In the **Reference type** page of the dialog, select a LOOKUP reference <mark style="color:green;">**(3)**</mark>
4. This will display a new step, in which you can select a Variable with which to perform the LOOKUP <mark style="color:green;">**(4)**</mark>. This Variable will need to have the same Dimensions as the Variable in which you are performing the Calculation. By default, this list will be filtered to Variables with the correct Dimensions.

{% hint style="info" %}
Create the Lookup Variable by using the [**Validation data type**](https://help.taglo.io/variables/variable-basics/variable-setup#validation-dimension) - in this case using `Inflation type` as the Validation Dimension.
{% endhint %}

<figure><img src="https://2847533834-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVy65sax6FVoNo2UTlJ0x%2Fuploads%2F47CxPJ1GfwF3QlZ2mNTA%2Fimage.png?alt=media&#x26;token=2fe6073a-1feb-47dc-8b2e-2e15266bd240" alt="Screenshots showing the steps described in this section for creating a Lookup reference"><figcaption><p>Creating a Lookup reference</p></figcaption></figure>
