How long does it take for vertigo to go away if it's caused by a virus?

it depends . Most will have it for a couple of days, usually resolves as viral illness rrsolve. If symtoms doesn't improve, then pls get yourself evaluated to make sure there are no inner ear problem or this is not neurological in origin, take care.