Jump to content

Recommended Posts

Posted

I couldn't find a function to do this, so I used "ceiling" and "floor" together with "trunc", and some nested "if"'s to do it for me... now this is what I got:

 

=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))))))

 

my question is... did I waste my time? Is there an easier way? Ceiling and floor round, but only in one direction, so you need the if's to determine which way to round the number. the nested truncs are just to get rid of the numbers at the beginning.

 

The function is only designed to work on numbers between 0 and 100, for rounding students' grades to the nearest 5.

Posted

Perhaps you should submit your code to the International Obfuscated Excel Spreadsheet Contest.

 

Hmmm -- there doesn't seem to be one. That doesn't make sense. Obfuscating Excel is even easier than obfuscating Perl. Or C. Or Ruby.

 

Sometimes it is better to be terse. For example, I authored a simple 19 character C program that will perform every computation known to mankind. I still use this program occasionally, mainly to check C and C++ syntax.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.