--- title: "lookup" description: "This looks for lookupValue in the lookupColumn of dataset." --- # lookup > This looks for lookupValue in the lookupColumn of dataset. **This function is used by Ignition's Expression language.** ## Description This looks for lookupValue in the lookupColumn of dataset. If it finds a match, it will return the value from the resultColumn on the same row as the match. If no match is found, noMatchValue is returned. :::note The type of the value returned will always be coerced to be the same type as the noMatchValue. ::: ## Syntax `lookup(dataset, lookupValue, noMatchValue, [lookupColumn], [resultColumn])` ### Parameters | Type | Parameter | Description | |---------|-----------------|-----------------------------------------------------------------------------------------------------------| | Dataset | `dataset` | A dataset to search through. | | Object | `lookupValue` | The value to look for in the dataset. | | Object | `noMatchValue` | The value to return if no match is found. | | Object | `lookupColumn` | The column to search for the lookup value. Can be the column index or name. Defaults to column 0. [optional] | | Object | `resultColumn` | The column to retrieve the result value from. Can be the column index or name. Defaults to column 1. [optional] | ### Returns **Object** - The value in the result column of the same row where the lookupValue was found, or the noMatchValue if no match was found. The data type of the result will always match the type of the noMatchValue. ## Examples The examples are based of a table that has the following data in it: | Product | Price | Category | |---|---|---| | "Apples" | 1.99 | "Fruit" | | "Carrots | 3.5 | "Vegetable" | | "Walnuts" | 6.25 | "Nut" | ```python title="Code Snippet" lookup({Root Container.Table.data}, "Carrots", -1.0) //returns 3.50 ``` ```python title="Code Snippet" lookup({Root Container.Table.data}, "Grapefruit", -1) //returns -1, the noMatchValue ``` ```python title="Code Snippet" lookup({Root Container.Table.data}, "Walnuts", "Unknown", 0, "Category") //returns "Nut" ``` ```python title="Code Snippet" lookup({Root Container.Table.data}, "Pecans", "Unknown", 0, 2) //returns "Unknown", the noMatchValue ```