If you invest \$1000 , and you get paid \$500 in 5 years, \$1000 in 10 years, and \$1500 in 15 years and then get a final payment of \$2000 in twenty years, what is the effective annual rate of interest you got? Assume that your bank account pays 1% interest for money lying in the account.
I have attached a screenshot of what I am doing. I using the concept of time value of money. The amount function I call calculate future value of money. I am calculating the value of all payments received after 20 years at 1%. \$500 earns 1% interest for 15 years, \$1000 for 10, \$1500 for 5 and \$2000 doesn't earn any interest. I then equate the total value to the amount if the initial investment had been compounded for 20 years at rate r% and solve for r to get effective annual rate. Using this method, I am getting the effective rate to 8.66%. Is this correct or I am missing something?

There can be two cases to this question.
Assuming that the principal has been deposited in the bank in the first place. In this case, you have not included the initial investment in your final result which would give an inaccurate effective rate of interest.
If the principal has not been deposited in the bank in the first place i.e. it has been invested in some company which gives dividends and you are depositing those dividends into your bank account. In this case, you don't need to include the principal in the calculation of the effective rate of interest. This is because your bank account only got "activated" after the first deposit.
The bank does not care how or where you invested your money in the first place. It only cares about the deposits made into it. Thus, the principal has to be taken to be 500 with the total number of years as 15. The 1000 dollars in the beginning have not gone to the bank and thus are irrelevant to the bank in the calculation of interest.
Now you can try to calculate the effective rate of interest after confirming from your instructor(assuming this is a homework problem) which of the above cases apply here.