Retirement tax questions

What would happen if someone contributed in 2018 to their 2017 Roth IRA prior to the deadline(in January 2018 for example), but those 2018 contributions to their 2017 IRA were in excess and removed prior to the deadline(in March 2018 for example)? If there were earnings would that still fall under taxable in 2017 because it was contributions to a 2017 Roth IRA?