Aug 30, 2002 #1 godfreyw Programmer Joined Aug 30, 2002 Messages 2 Location US I am try to round 23 to the nearest 5 or 10 how do i do that?
Aug 30, 2002 #2 darrellblackhawk Programmer Joined Aug 30, 2002 Messages 846 Location US godfreyw: What do you mean round 23 to nearest 5 or 10 ? Darrell Upvote 0 Downvote
Aug 30, 2002 #3 DSummZZZ Programmer Joined Oct 24, 2000 Messages 4,250 Location US Just in case you don't see the other post, here's an ugly one: STORE 23 TO num iif(num % 10 = 0, num, ; iif(num % 10 < 6, num - (num % 10) + 5, ; iif(num % 10 > 5 , num - (num % 10) + 10, 999999999))) Dave S. Upvote 0 Downvote
Just in case you don't see the other post, here's an ugly one: STORE 23 TO num iif(num % 10 = 0, num, ; iif(num % 10 < 6, num - (num % 10) + 5, ; iif(num % 10 > 5 , num - (num % 10) + 10, 999999999))) Dave S.
Aug 30, 2002 #4 ramani Programmer Joined Mar 15, 2001 Messages 4,336 Location AE Hi Godfrey, myNumber = 43 ? ROUND(myNumber/5,0)*5 gives rounded to 5 ? ROUND(myNumber/25,0)*25 gives rounded to 25 ? ROUND(myNumber/10,0)*10 gives rounded to 10 ? ROUND(myNumber,-1) gives rounded to 10 ? ROUND(myNumber,-2) gives rounded to 100 Hope this helps you ramani (Subramanian.G),FoxAcc, ramani_g@yahoo.com Upvote 0 Downvote
Hi Godfrey, myNumber = 43 ? ROUND(myNumber/5,0)*5 gives rounded to 5 ? ROUND(myNumber/25,0)*25 gives rounded to 25 ? ROUND(myNumber/10,0)*10 gives rounded to 10 ? ROUND(myNumber,-1) gives rounded to 10 ? ROUND(myNumber,-2) gives rounded to 100 Hope this helps you ramani (Subramanian.G),FoxAcc, ramani_g@yahoo.com
Aug 30, 2002 #5 danceman Programmer Joined Jun 3, 2002 Messages 1,012 Location US temp = 51 ? iif(temp%5<3,temp-temp%5,temp+(5-temp%5)) will result in 50 temp = 53 will result in 55 temp = 56 will result in 55 temp = 58 will result in 60 the key to this is the 5, it is the point of round off, of course I am guessing at what you asked by rounding off. Attitude is Everything Upvote 0 Downvote
temp = 51 ? iif(temp%5<3,temp-temp%5,temp+(5-temp%5)) will result in 50 temp = 53 will result in 55 temp = 56 will result in 55 temp = 58 will result in 60 the key to this is the 5, it is the point of round off, of course I am guessing at what you asked by rounding off. Attitude is Everything
Aug 31, 2002 #6 Guest_imported New member Joined Jan 1, 1970 Messages 0 Hi, is 'nRounded=int((23+2.5)/5)*5' O.K.? Upvote 0 Downvote