Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers 2

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 }
   chomp;
   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
add comment

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
1  
I would need something more specific. Thanks –  Will Oct 12 '12 at 21:47
add comment

Your Answer

 
discard

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.