Please help me to setup a formula to calculate Payback Period.

For example,
Investment ($1,000)
Year 1 $300
Year 2 $400
Year 3 $500
year 4 $600
Year 5
Year 6
Year 7
So the return period is 2+((1,000-700)/500) = 2.6 Years

I think I need to set a formula the SUM(Investment:Year 7) and it can automatically detect when to stop and calculate the period.

Please help if anyone knows.

Thank you.