Yes, the IP address surely affects your SEO.
Just say if you are using shared hosting and along with your site, there are other 1000 sites hosted. In this case, all the sites will have the same IP address. So if suppose other 999 sites are involved in spam activities, spammy blogs, thin affiliates, etc. then there will be a problem for everyone. SEO will think that all the sites are the same and it will ban your site with other sites.
Therefore, one must use a dedicated IP address for better SEO results.