1. Calculation functions
  2. All Functions
  3. Miscellaneous Functions
  4. CODE

The CODE function returns a list item's code.

For example, you can use the CODE function to ensure that a formula only applies to a specific employee in a list.

Syntax

CODE(Item)

Arguments

ArgumentData typeDescription
ItemList or time periodThe list item or time period to return the code of.

The CODE function returns a text value. If a list item does not have a code, the CODE function returns a blank value.

Additional information

When adding codes to list items, you can manually add or import codes from the Grid View of the corresponding list.

Excel equivalent function

LOOKUP

Related Anaplan functions

Examples

Example usage with lists as dimensions

In this example, a Sales Commission Rates module has line items on rows and the Sales Personnel list on columns. The Personnel Code line item has a text data type.

The formula uses the ITEM function to identify the list item in the Sales Personnel list, and the CODE function to return the code of that list item.


John JohnsonBarbara JonesHannah Smith
Length of Service (years)682
Commission Rate %3.25%3.5%2%

Personnel Code

CODE(ITEM(Sales Personnel))

SP001SP002SP003

Example usage with list-formatted line items

In this example, an Income Statement module has line items on rows, time on columns, and the Regions list on pages. The Personnel Code line item has a text data type. The Sales Staff line item has a list data type on the Sales Personnel list.

The formula uses the CODE function to return the code of the corresponding list item in Sales Staff.


Jan 21Feb 21Mar 21Apr 21May 21Jun 21
Sales StaffJohn JohnsonJohn JohnsonJohn JohnsonHannah SmithHannah SmithHannah Smith
Sales Commission 20,36610,30013,42220,0021,99915,698

Personnel Code

CODE(Sales staff)

SP001SP001SP001SP003SP003SP003