SLICE (+video)

The SLICE function returns the subset of values between the start and end positions. Often used to remove a header row.

Let's get started by watching the following videos!

Introduction to SLICE

 

SLICE( values, start, end )

start and end are optional parameters.

Examples

The examples in this section use this data set.

  A B
1 Fruit Units
2 Apples 10
3 Oranges 15
4 Pears 20

Use SLICE to remove headers

SLICE, with no start and end parameters will clean up the data selection so that the first value (column header) is not included in the selection. If new cells are added to the end of the column, they  will be automatically included in the selection. 

Set values with the column you want to select. In the below example, values is set to A:A.

Formula: SLICE ( values )

Result: Apples, Oranges, Pears

Note: You can use the Filter action to remove your column header.

Use SLICE to specify a subset of values

This example uses SLICE to specify values between start and end parameters.

Note: Cell A1 is counted as a 0.

Formula: SLICE ( values , 1 , 3 ) 

Result: Apples, Oranges

 

This example uses SLICE to remove the top two and bottom two rows from a data source. For example, a header and blank row at the top of the data source and a blank row and totals row at the bottom of the data source.

Formula: SLICE ( values, 2, -2 )

Result: Apples

Related links: