Although the process could not be completed, Disk Utility has already attempted to erase data on the drive, and part of the drive data may be damaged, such an error could also corrupt the drive.
The external hard drive is unmountable and unrecognizable on Mac after you accidentally format it but Disk Utility won't erase the external drive. What you can rely on to recover data from your external hard drive with third-party data recovery software for Mac such as iBoysoft Data Recovery for Mac.
You can download and install iBoysoft Data Recovery for Mac to scan the problematic external hard drive, it allows you to filter and preview the scanned result, and then you can recover wanted item to a different drive. You should not use the drive before you perform a data recovery to avoid overwriting.
After that, you can try these methods to make the drive usable again:
Force mount the drive in Disk Utility or Terminal.
Run Disk Utility First Aid on the drive.
Format the external hard drive on the Mac again.