> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# ArraySlice

The **ArraySlice** function returns a portion of an array, defined by the starting index and length.

This function isn't compatible with all data platform connections. To check if your connection supports it, see [Supported data platforms and feature compatibility](/docs/region-warehouse-and-feature-support#supported-data-platforms-and-feature-compatibility).

## Syntax

`ArraySlice(array, start, length)`

The **ArraySlice** function has the following arguments.

In general, if any of the arguments used by the function is `Null`, it returns `Null`.

<dl>
  <dt id="array">
    array
  </dt>

  <dd>
    Required.
  </dd>

  <dd>
    The input array that Sigma parses to extract a portion as a new array.
  </dd>

  <dd>
    Must be an array structure; to create single array from a column, use the 

    <a href="/docs/arrayagg" target="_self">ArrayAgg</a>

     function.
  </dd>

  <dd>
    If this value is 

    <code>Null</code>

    , then Sigma does not return an array; see 

    <a href="#examples">Example 12</a>

    .
  </dd>

  <dd>
    If the array is empty, Sigma returns an empty array; 

    see&#x20;

    <a href="#examples">Example 11</a>

    .
  </dd>

  <dt id="start">
    start
  </dt>

  <dd>
    Required.
  </dd>

  <dd>
    The beginning, or the starting index for extracting the new array from the original array.
  </dd>

  <dd>
    The range of valid valued are from 

    <code>0</code>

     to 

    <code>ArrayLength(array) - 1</code>

    .
  </dd>

  <dd>
    If the value calculates beyond the end of the original array, Sigma returns an empty array, represented as 

    <code>[]</code>

    . See 

    <a href="#examples">Example 4</a>

    , 

    <a href="#examples">Example 5</a>

    , and 

    <a href="#examples">Example 11</a>

    .
  </dd>

  <dd>
    Negative values count from the end of the array, so 

    <code>-2</code>

     is the second from the last position in the original array.
  </dd>

  <dd>
    If this value is negative and the index calculates beyond the beginning of the original array, then the value 

    <code><a href="#start">start</a></code>

     defaults to 

    <code>0</code>

    . See 

    <a href="#examples">Example 9</a>

    .
  </dd>

  <dd>
    If this value is negative and Sigma applies a 

    <code>Null</code>

     

    <code><a href="#length">length</a></code>

     value, it does not return an array; see 

    <a href="#examples">Example 6</a>

    , column 

    <em><strong>ArraySlice(array, start, length)</strong></em>

    .
  </dd>

  <dd>
    If both 

    <code><a href="#start">start</a></code>

    &#x20;and&#x20;

    <code><a href="#length">length</a></code>

    &#x20;are&#x20;

    <code>Null</code>

    , the function does not return an array; it evaluates to&#x20;

    Null

    . See&#x20;

    <a href="#examples">Example 13</a>

    .
  </dd>

  <dd>
    Sigma rounds floating numbers to the nearest integer; 

    see&#x20;

    <a href="#examples">Example 15</a>

    , where the applied start is&#x20;

    <code>3</code>

    .
  </dd>

  <dt id="length">
    length
  </dt>

  <dd>
    Optional.
  </dd>

  <dd>
    The length of the new array.
  </dd>

  <dd>
    If there is no value (

    <code>Null</code>

    ) and Sigma applies it, then it does not return an array; 

    see&#x20;

    <a href="#examples">Example 6</a>

    , column&#x20;

    <em><strong>ArraySlice(array, start, length)</strong></em>
  </dd>

  <dd>
    If the value is so large that the ending index calculates beyond the size of the original array, the function extracts from the start index to the end of the original array. See 

    <a href="#examples">Example 3</a>

    .
  </dd>

  <dd>
    If this value is negative, the function returns an empty array; 

    see&#x20;

    <a href="#examples">Example 14</a>

    .
  </dd>

  <dd>
    If both 

    <code><a href="#start">start</a></code>

     and 

    <code><a href="#length">length</a></code>

     are 

    <code>Null</code>

    , the function does not return an array; it evaluates to 

    <code>Null</code>

    . See 

    <a href="#examples">Example 13</a>

    .
  </dd>

  <dd>
    Sigma rounds floating numbers to the nearest integer; see 

    <a href="#examples">Example 2</a>

    , where the applied length is 

    <code>3</code>

    .
  </dd>
</dl>

## Examples

The following examples of **ArraySlice** function demonstrate how this function works.

![](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/54766504a9f1a910e2a3db24bc32cccec264eaf0080c018d2b337d7206491870/assets/docs-images/38dec82-image.png)

## Related resources

* [ArrayContains](/docs/arraycontains)
* [ArrayDistinct](/docs/arraydistinct)
* [ArrayLength](/docs/arraylength)