Answers.Body: <p>This is what I have used, some math and the <a href="https://twig.symfony.com/doc/2.x/filters/slice.html" rel="nofollow noreferrer"><code>slice</code></a> filter.</p>
  
  <pre><code>{% set midIndex = ((entry.myMatrixField|length) / 2)|round - 1 %}
  
  {% set blocksA = entry.myMatrixField|slice(0, midIndex) %}
  {% set blocksB = entry.myMatrixField|slice(midIndex, null) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-04T16:00:35.033Z
Answers.Text: For anyone wanting to round up rather than down, the method in the argument is 'ceil'. So it would then be: round(0, 'ceil') ie https://twig.symfony.com/doc/2.x/filters/round.html
Answers.UserDisplayName: Andrew
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-14T16:59:12.467Z
Answers.LastActivityDate: 2017-11-14T16:59:12.467Z
Answers.UserDisplayName: carlcs
Body: <p>Is it possible to limit and offset the output of a Matrix field by 50%? I wanted to split the data across two columns. </p>
  
Tags: <matrix>
Title: Limit/offset output of Matrix field by 50%
ThreadText: # Limit/offset output of Matrix field by 50%
  
  (Asked by: username_0 on 2017-11-14)
  
  Is it possible to limit and offset the output of a Matrix field by 50%? I wanted to split the data across two columns.
  
  **Tags:** matrix
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-11-14. Score: 2 | Accepted answer
  
  This is what I have used, some math and the [`slice`](https://twig.symfony.com/doc/2.x/filters/slice.html) filter.
  
  ```
  {% set midIndex = ((entry.myMatrixField|length) / 2)|round - 1 %}
  
  {% set blocksA = entry.myMatrixField|slice(0, midIndex) %}
  {% set blocksB = entry.myMatrixField|slice(midIndex, null) %}
  
  ```
  
  > **Comments:**
  > **username_0**: For anyone wanting to round up rather than down, the method in the argument is 'ceil'. So it would then be: round(0, 'ceil') ie https://twig.symfony.com/doc/2.x/filters/round.html  
  
  ---
  
  