title: How to change column values to rows in Excel with PowerShell
body: <p>For some testing I do for work, a CSV file is created with the numbers all on one row, but a lot of columns. I need all these numbers added together and then divided by the number of columns. When you open Excel and select all, excel already gives you an average.</p>
  
  <p>However, I want to do this automated in PowerShell and so far I haven't been able to do just this. I was able to get an average of values that were in rows, so my question would be either one of these:</p>
  
  <p>1: How can I calculate the average from all columns that have a value?
  or,<br>
  2: How can I get the values from the columns in rows instead of columns?</p>
  
  <p>From another CSV file, that I do get correctly, I currently use this code to get the average value over a total of 1500 rows.</p>
  
  <pre><code>Import-Csv "$test.csv" | Select 'Frame time' -First 1500 | Measure-object 'Frame time' -ave | Select-Object -expand Average
  </code></pre>
  
  <p>One more question would be, is there a way to make a calculation with the value that is returned, instead of typing it over and putting it in a calculation as a variable?</p>
  
  <p>I'm fairly new to PowerShell scripting, and I find these kind of actions pretty difficult (to find).</p>