Lookup

This function returns the value of a single column from a Data Extension.

Arguments

Lookup(1,2,3,4,[5a,5b]...)

Ordinal Type Required Description
1 String True Name of the Data Extension from which to return a value
2 String True Name of the column from which to return a value
3 String True Name of the column that identifies the row to retrieve
4 String True Value that identifies the row to retrieve
5a String False Additional column name that identifies the row to retrieve (see note)
5b String False Additional value that identifies the row to retrieve (see note)

NOTE: Additional pairs of columns and values can be appended as arguments.

NOTE: If the specified name and value pair criteria match more than one row in the Data Extension, a single value is still returned. The row chosen for the return value cannot be specified and should be not considered consistent.

Example 1

The following illustrates the use of this function with the minimum number of arguments.

Data Extension: LoyaltyMembers

Name Data Type Length Primary Key Nullable Default Value
EmailAddress EmailAddress 254 N N
SubscriberKey Text 254 Y N
FirstName Text 50 N Y
LastName Text 50 N Y
Created Date N Y Current Date

The LoyaltyMembers Data Extension includes these rows:

EmailAddress SubscriberKey FirstName LastName Created
doug@limedash.com 8473 Doug Smith 2017-10-21 12:01
suzy@limedash.com 5497 Suzy Jackson 2017-10-20 11:01
dale@limedash.com 7114 Dale Cameron 2017-10-19 10:01

Here is an example utilizing the preceding context:

%%[

var @EmailAddress, @lookupValue

set @lookupValue = AttributeValue("_subscriberkey") /* value from attribute or DE column in send context */
set @lookupValue = "5497" /* or a literal value */

set @EmailAddress = Lookup("LoyaltyMembers","EmailAddress","SubscriberKey", @lookupValue)

]%%
EmailAddress: %%=v(@EmailAddress)=%%

Output

EmailAddress: suzy@limedash.com

Example 2


Not a subscriber? Subscribe now.