Lookup()

Returns the data in a specific column from a data extension in Marketing Cloud Engagement or a marketing object in Marketing Cloud Next. To call this function, you supply the name of the column to search, the value to match, and the column to return.

If your search criteria return more than one result, the system returns the first matching value it finds. For this reason, it’s best to use this function to search for identifiers that are unique within the data extension or marketing object.

AMPscript also includes several functions that you can use to retrieve multiple rows of data from a data extension in Marketing Cloud Engagement.

  • The LookupRows() function retrieves one or more rows based on the criteria you specify.
  • The LookupRowsCS() function is a case-sensitive version of the LookupRows() function.
  • The LookupOrderedRows() function allows you to specify a column and direction to sort the rowset by.
  • The LookupOrderedRowsCS() function is a case-sensitive version of LookupOrderedRows().

Availability

<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>✅ Yes</td> </tr> </table>

This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).

Syntax

Lookup(dataObject,
       returnColumn,
       searchColumn1, searchValue1,
       [searchColumn2, searchValue2...])
  • dataObject (string): Required. The data object that contains the data to look up. In Marketing Cloud Engagement, specify the name of a data extension. In Marketing Cloud Next, specify the API Name of a marketing object.
  • returnColumn (string): Required. The name of the column to return data from.
  • searchColumn1 (string): Required. The name of the column to search. This value is case-sensitive.
  • searchValue1 (string): Required. The value that identifies the rows to retrieve. This value is case-sensitive.

note: In Marketing Cloud Next, an odd number of search arguments returns an error. For each searchColumn value you provide, always include a corresponding searchValue.

Also, all filter keys must fully specify the composite primary key of the target marketing object.

You can optionally append additional search columns and values to the end of the parameter string.

Usage

This example uses a data extension called "Regions of Japan," which contains the data in this table.

NameEN NameJA LargestCityEN LargestCityJA Population2020 AreaKM2
Hokkaido 北海道 Sapporo 札幌市 5400000 83000
Tohoku 東北地方 Sendai 仙台市 8900000 67000
Kanto 関東地方 Tokyo 東京 43300000 32000
Chubu 中部地方 Nagoya 名古屋市 21400000 67000
Kansai 関西地方 Osaka 大阪市 22500000 33000
Chugoku 中国地方 Hiroshima 広島市 7300000 32000
Shikoku 四国 Matsuyama 松山市 3800000 19000
Kyushu 九州 Fukuoka 福岡市 14300000 44000

This code searches for a row in which the value of the NameEN column is Kanto. It then returns the value in the NameJA column for that row.

%%[
  Var @kantoJA
  Set @kantoJA = Lookup("Regions of Japan", "NameJA", "NameEN", "Kanto")
]%%
<p>The name of the Kanto region in Japanese is %%=v(@kantoJA)=%%.</p>

The code example outputs the value of the specified column.

The name of the Kanto region in Japanese is 関東地方.

See Also