Explanation
The PROPER function automatically reformats text so that all words are capitalized. At the same time, it lowercases all other text.
If you also need to strip out extra spaces in the names, you can wrap PROPER in the TRIM function:
=TRIM(PROPER(name)
This will strip any leading and trailing spaces, and convert runs of spaces to a single space.