PoshCode Logo PowerShell Code Repository

Get-GrowthRate (modification of post by jturnage view diff)
View followups from halr9000 | diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/701"></script>download | new post

Calculates percentage growth rate given a starting value, ending value, and number of periods in the range. @stahler thx!

  1. function Get-GrowthRate {
  2.         param( $Start, $End, $Period )
  3.         $rate = [math]::Abs( [math]::Pow( ( $End / $Start ),( 1 / ($Period - 1 ) ) - 1 )
  4.         "{0:P}" -f $rate
  5. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me