Answers.Body: <p>It's actually quite simple! What you're looking for is <a href="http://twig.sensiolabs.org/doc/filters/batch.html" rel="noreferrer">Twig's <code>batch</code> filter...</a> Ironically, the example given on that page is nearly identical to what you are requesting.</p>
  
  <p>I've adapted the example to more closely match what you're looking for:</p>
  
  <pre><code>{% set myData = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}
  
  {% for column in myData|batch(3, 'No item') %}
      &lt;div class="medium-3 medium-offset-2 small-centered medium-uncentered columns"&gt;
          &lt;ul&gt;
              {% for item in column %}
                  &lt;li&gt;{{ item }}&lt;/li&gt;
              {% endfor %}
          &lt;/ul&gt;
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T18:38:49.343Z
Answers.Text: Thanks Lindsey, I did see that, however this will create multiple columns with ONLY three list items in that column. What I actually need is ONLY three columns at the most that can divide up the amount of list items
Answers.UserDisplayName: ninjaroll
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T14:14:55.063Z
Answers.Text: With a little addition to the solution of Lindsey you can achieve this. Instead of using a fixed value "3" for the batch you could calculate the size of each list before.
  
      {% set loopLength = myData|length % 3 %}
  
      {% for column in myData|batch(loopLength, 'No item') %}
Answers.UserDisplayName: Pascal Mollet
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-18T10:46:14.670Z
Answers.Text: @PascalMollet This worked like a charm for me! But instead i divided the array by the number of columns I wanted, instead of using %
Answers.UserDisplayName: Jason Mayo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T03:45:19.080Z
Answers.LastActivityDate: 2015-05-28T03:45:19.080Z
Answers.UserDisplayName: Lindsey D
Body: <p>I'm building out my first Craft site and learning a whole lot so far. Coming from ExpressionEngine, this really seems like what EE should have been. </p>
  
  <p>Anyway, I'm trying to find a way divide up content from a table field into three even columns. For example, if I have content in 9 rows in a table, I would like to have 3 items per column. Is this possible with Twig?  Here is the HTML.  Thank you!</p>
  
  <pre><code>&lt;div class="medium-3 medium-offset-2 small-centered medium-uncentered columns"&gt;
      &lt;ul&gt;
          &lt;li&gt;item&lt;/li&gt;
          &lt;li&gt;item&lt;/li&gt;
          &lt;li&gt;item&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div class="medium-3 medium-offset-2 small-centered medium-uncentered columns"&gt;
      &lt;ul&gt;
          &lt;li&gt;item&lt;/li&gt;
          &lt;li&gt;item&lt;/li&gt;
          &lt;li&gt;item&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div class="medium-3 medium-offset-2 small-centered medium-uncentered columns"&gt;
      &lt;ul&gt;
          &lt;li&gt;item&lt;/li&gt;
          &lt;li&gt;item&lt;/li&gt;
          &lt;li&gt;item&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
Tags: <table-field>
Title: Evenly dividing up table items in columns
ThreadText: # Evenly dividing up table items in columns
  
  (Asked by: username_0 on 2015-05-27)
  
  I'm building out my first Craft site and learning a whole lot so far. Coming from ExpressionEngine, this really seems like what EE should have been.
  
  Anyway, I'm trying to find a way divide up content from a table field into three even columns. For example, if I have content in 9 rows in a table, I would like to have 3 items per column. Is this possible with Twig? Here is the HTML. Thank you!
  
  ```
  <div class="medium-3 medium-offset-2 small-centered medium-uncentered columns">
      <ul>
          <li>item</li>
          <li>item</li>
          <li>item</li>
      </ul>
  </div>
  
  <div class="medium-3 medium-offset-2 small-centered medium-uncentered columns">
      <ul>
          <li>item</li>
          <li>item</li>
          <li>item</li>
      </ul>
  </div>
  
  <div class="medium-3 medium-offset-2 small-centered medium-uncentered columns">
      <ul>
          <li>item</li>
          <li>item</li>
          <li>item</li>
      </ul>
  </div>
  
  ```
  
  **Tags:** table-field
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-28. Score: 7
  
  It's actually quite simple! What you're looking for is [Twig's `batch` filter...](http://twig.sensiolabs.org/doc/filters/batch.html) Ironically, the example given on that page is nearly identical to what you are requesting.
  
  I've adapted the example to more closely match what you're looking for:
  
  ```
  {% set myData = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}
  
  {% for column in myData|batch(3, 'No item') %}
      <div class="medium-3 medium-offset-2 small-centered medium-uncentered columns">
          <ul>
              {% for item in column %}
                  <li>{{ item }}</li>
              {% endfor %}
          </ul>
      </div>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks username_1, I did see that, however this will create multiple columns with ONLY three list items in that column. What I actually need is ONLY three columns at the most that can divide up the amount of list items  
  > **username_2**: With a little addition to the solution of username_1 you can achieve this. Instead of using a fixed value "3" for the batch you could calculate the size of each list before.      {% set loopLength = myData|length % 3 %}      {% for column in myData|batch(loopLength, 'No item') %}  
  > **username_3**: @username_2 This worked like a charm for me! But instead i divided the array by the number of columns I wanted, instead of using %  
  
  ---
  
  