---
schema_version: "1"
id: 9ce38e978136d0c1c0b49e2c7a3e597e03d172020183bb9b02f5fc0fd468d437
title: Rows.Lookup
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_dataExtensionRowsLookup.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_dataExtensionRowsLookup.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 98e47ced8b5a940ab9f47540672b81246ce2423855b6e65032ca45ba15140de6
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# Rows.Lookup

## Overview

Returns columns that match the specified values

### Syntax

Rows.Lookup(1, 2, 3, 4)

### Function Properties

<!--complex table-->

| Ordinal | Type    |              | Description                |
| ------- | ------- | ------------ | -------------------------- |
| **1**   | string  | **Required** | Columns to search for data |
| **2**   | string  | **Required** | Values uses in search      |
| **3**   | numeric |              | number of rows to return   |
| **4**   | string  |              | Order of rows to return    |

## Examples

This sample code returns all rows in birthdayDE with a value of 25 for Age.

```
var testDE = DataExtension.Init("testDE");
var data = testDE.Rows.Lookup(["Age"], [25]);
```

This sample code returns the same rows in birthdayDE, but it limits the results to two rows and sorts the results by last name.

```
var testDE = DataExtension.Init("testDE");
var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
```

When initializing data extensions with Lookup() in an email, you must use the name of the data extension. When using the function in landing pages, you can use either the name or the external key of the data extension. Make the name and the external key the same value when creating the data extension to ensure you use the correct value at all times.
