If you format the drive using the Windows installer (custom option), the upgrade version will take note that you had an activated OS there before and will let you reactivate after you reinstall it. By contrast, you can't install onto a drive that has been formatted before.
http://windows.microsoft.com/en-US/windows7/Installing-and-reinstalling-Windows-7
See "Using the Custom installation option and formatting the hard disk"