Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have about 1,200 rows and I am trying to put them into columns after every twenty rows. How would I do this with out manually copying and pasting a hundred times? Also, I would like to add the values of each resulting column and take the average. Thanks for your help!

share|improve this question

There probably is a way to do this in LibreOffice, but I think it'd be simpler to use a scripting language for this, e.g. Perl. Save the sheet to a text file (e.g. input.txt) and run the following command:

 perl -ne '
   BEGIN{ $i=0 }
   if (defined $arr[$i]) {
     $arr[$i] .= ",".$_;
   } else {
     $arr[$i] = $_;
   $i = ($i + 1) % 20;
   END { print join "\n", @arr }
 ' input.txt > output.csv

Import output.csv in LibreOffice.

share|improve this answer
This was a good idea. I used PHP and averaged every twenty numbers. I found out the csv syntax to make a new column. While commas divide each value into a new cell, a carriage return divides the next values into a new column. I would still like to know how to directly do this in libre office – Will Oct 12 '12 at 21:56

You can probably do this with the " =OFFSET() " function in Excel, or since you're using Libre Office it has something similar called " =INDEX() " I think.

share|improve this answer
I would need something more specific. Thanks – Will Oct 12 '12 at 21:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.