annual roi code example Example: investment return formula ROI = ([($12.50 - $10.00) * 1000 + $500 - $125] ÷ ($10.00 * 1000)) * 100 = 28.75%