First, if the 2017 contribution was timely removed as a "return of contribution" by the due date of the 2017 tax return then it is treated as if the contribution never took place so you do not report any excess contribution in 2017 at all. You do not report the removed contribution on your 2017 tax return at all in the contribution section.
Second, if the contribution plus earnings were returned in 2018 you should have received a 2018 1099-R with a code "JP" in box 7. That can only be reported on an amended 2017 tax return since any gains are taxable in the tax year that the contribution was for - 2017.
Nothing gets entered on a 2018 tax return.