Maybe. Maybe not.
It depends on the type of formatting used. A "Quick" Format simply clears the journal and file tables, and marks the entire disk as free space. It does not go through the entire disk (or partition). This is why a "Quick" format is much quicker.
But the data is still there and can be recovered with file recovery software - or a bad guy! Re-installing the OS will overwrite ONLY those storage locations used during the OS installation. The locations that go untouched will still contain the previously stored data - until overwritten by another file.
"IF" the previously stored data is only corrupt (and not infected) a "Quick" format is probably fine. But if there is a chance the previous data still contains any malicious code, a "Full" format would be advisable - just to be sure.
If there are any "new" bad sectors on the disk (new since the drive left the factory, or was last formatted using the "Full" format option) a "Quick" format will not find them. This typically is not a problem.
If me, since you said there was a virus, I would do a "Full" format before installing the OS. A "Full" format touches each storage location, clears the files/data completely from the drive/partition, rebuilds the file system, volume label, and cluster size, and scans the drive/partition for logical bad sectors, marking them as bad (and unavailable) if any new are found.
The downside is a Full format may take awhile - especially on a large drive. A 2TB drive, for example, could take 2 - 3 hours or even longer. Still worth it, IMO.
Umm, we are talking about a hard drive, right? And not a SSD? Typically a "Quick" format is recommended for SSDs. This stems from first generation SSDs suffering from write limits of those drives. But newer generation SSDs don't suffer from such limits (except, maybe, in very busy data centers) so I would still do a Full format before installing the OS.