Yes this can be done, provided that you upgrade from x86 to x86 or from x64 to x64. If you are trying to go from an x86 OS to an x64 OS this is not supported.
Also you can not go down an edition. In other words you can’t go from Enterprise to Standard. You have to go to the same edition or to a higher edition.