If a voter marks more names than there are persons to be elected or nominated to an office or if for any reason it is impossible to determine the voter’s choice for any office to be filled, his ballot shall not be counted for such office; but this shall not vitiate the ballot, so far as properly marked. Nothing herein shall be construed to prevent any voter in a general or special election from voting for any qualified person, other than those whose names are printed on the ballot, by writing in the name of the person opposite the office.