If you have the data folder in place when you install PostgreSQL it should reconnect to the existing data folder if you uncheck the 'initialize database cluster' option.
See the 'how to uninstall/re-install PostgreSQL guide' in the
Documentation for more information. This guide explains how to keep your existing databases when reinstalling, and if you have put back your old data folder then the same will apply.