I am assuming that Rufus didn't work either. I am a bit perplexed because Windows 8.1 installed successfully. What is the size of the HDD?
One possibility is that the partition you wish to install to is a GPT partition. You need to convert this to MBR to allow installation of Windows 7.
Boot into Windows 7 installation media
We want to open a command prompt. In the first screen, click on Repair Your Computer. On the next screen, click on Command Prompt.
Type and enter: DISKPART
Type and enter: LIST DISK
Type and enter: SELECT DISK 0 (If there is more than one drive, replace 0 with the correct number.)
Type and enter: CLEAN
Type and enter: CONVERT MBR
Type and enter: EXIT
Restart and try the installation again.
Another cause of this error is faulty memory. Because you stated that new RAM was installed, I would think this is a possibility. However, if this was the case, the Windows 8.1 installation should have failed to. I figure it is still worth checking.
This is a memory diagnostic tool utility called
MemTest86 that can be booted from a USB flash drive. The free version is all you need.
https://www.memtest86.com/