The CODE function returns a list item's 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.
CODE(Item)
Argument | Data type | Description |
Item | List or time period | The 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.
When adding codes to list items, you can manually add orimportcodes from theGrid Viewof thecorresponding list.
In Polaris, if you use a time period value for theItemargument, the CODE function returns a blank text result.
In the Classic Engine, if you use a time period value for theItemargument, the CODE function returns the time period value as text.
In this example, aSales Commission Ratesmodule has line items on rows and theSales Personnellist on columns. ThePersonnel Codeline item has a text data type.
The formula uses theITEMfunction to identify the list item in theSales Personnellist, and the CODE function to return the code of that list item.
John Johnson | 芭芭拉乔nes | Hannah Smith | |
Length of Service (years) | 6 | 8 | 2 |
Commission Rate % | 3.25% | 3.5% | 2% |
Personnel Code
|
SP001 | SP002 | SP003 |
In this example, anIncome Statementmodule has line items on rows, time on columns, and theRegionslist on pages. ThePersonnel Codeline item has a text data type. TheSales Staffline item has a list data type on theSales Personnellist.
The formula uses the CODE function to return the code of the corresponding list item inSales Staff.
Jan 21 | Feb 21 | Mar 21 | Apr 21 | May 21 | Jun 21 | |
Sales Staff | John Johnson | John Johnson | John Johnson | Hannah Smith | Hannah Smith | Hannah Smith |
Sales Commission | 20,366 | 10,300 | 13,422 | 20,002 | 1,999 | 15,698 |
Personnel Code
|
SP001 | SP001 | SP001 | SP003 | SP003 | SP003 |
Disclaimer
We update Anapedia content regularly to provide the most up-to-date instructions.