Subject: | |
From: | |
Reply To: | |
Date: | Fri, 10 Jan 2003 01:05:02 +0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
In message <[log in to unmask]>,
"Jensen, Gary" <[log in to unmask]> writes
>I was wondering if anyone has worked out a method to round to the nearest
>nickel using Quiz?
Here's one using Excel that will work for the nearest 'anything':
=Round_To*INT(0.5+Number/Round_To)
where 'Number' is what you want to round, and Round_To is what you want
to round it to the nearest of. 0.5 is always 0.5, and doesn't depend on
Round_To.
I forget my Quiz syntax, but you should be able to convert the above
formula without trouble. If Quz hasn't got an INT(eger) function as
such, just use an intermediate value whose format is integer at that
point.
If you are working in dollars and cents, then providing you express
Round_To in cents as well, it all still works; no 100s needed anywhere.
I had to look up what a nickel was (5 cents), but it turns out it
doesn't matter......
Both these points seem slightly counter-intuitive - seems like it ought
to be 'harder' than that. But no. Isn't math wonderful?
Number Result
$0.01 $0.00 $0.05 <-Round_To
$0.02 $0.00
$0.03 $0.05
$0.04 $0.05
$0.05 $0.05
$0.06 $0.05
$0.07 $0.05
$0.08 $0.10
$0.09 $0.10
$0.10 $0.10
$0.11 $0.10
$0.12 $0.10
$0.13 $0.15
$1.14 $1.15
$2.15 $2.15
$306.16 $306.15
$306.17 $306.15
$25,306.18 $25,306.20
--
Roy Brown 'Have nothing in your houses that you do not know to be
Kelmscott Ltd useful, or believe to be beautiful' Wm Morris
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|