# MOVECELLS

#### Syntax <a href="#syntax" id="syntax"></a>

**MOVECELLS**(*range*; *direction*; *option*)

* *range* - the range in which cells should be moved - ***Value type**: range*
* *direction* - the direction in which the non-empty cells should be moved - ***Value type**: constant*

  Possible values are

  * *leftward* - move non-empty cells to the left
  * *rightward* - move non-empty cells to the right
  * *upward* - move non-empty cells up
  * *downward* - move non-empty cells down
* *option* - specifies if empty cells between non-empty cells should be removed - ***Value type**: constant (optional, default: outside)*

  Possible values are

  * *outside* - only the first or last empty cells are removed
  * *inside* - only empty cells between non-empty cells are removed
  * *both* - all empty cells outside and inside are removed

#### Remarks <a href="#remarks" id="remarks"></a>

* The size of the range is preserved, even if the last or first columns or rows contain only empty cells after the operation.
* Common use cases include retrieving leaf elements of a column-based hierarchy or converting a hierarchy to a single column.
