i'm either a genius or a time-waster or both

hermanntrude

^^^^^^^^^^^^^^^^^^^
Jun 23, 2006
7,267
118
63
45
Newfoundland!
My work requires me to round my students' grades to the nearest 5. Excel didn't seem to have a function which could do this, so I set out to do it for myself. After an hour or so of experimenting, I came up with this function:

=IF((A29-(10*(TRUNC((TRUNC(A29))/10))))<2.5,FLOOR(A29,5),(IF((A29-(10*(TRUNC((TRUNC(A29))/10))))<5
,CEILING(A29,5),(IF((A29-(10*(TRUNC((TRUNC(A29))/10))))<7.5,FLOOR(A29,5),CEILING(A29,5))))))

where A29 is the cell which contains the grade to be rounded.

My question to you is "was there an easier way?"

for your information, "ceiling" returns a specified number rounded UP to a certain significance (5 in this case), and "floor" rounds down in the same manner. "Trunc" returns a number without any decimals.