Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rounding numbers to the nearest .9

Status
Not open for further replies.

ch4meleon

Technical User
Jan 13, 2003
60
GB
Ok, I need to make a query to group numbers so i can see how many i have in a given band.
I need to be able to round the numbers i have in my table to the nearest .9 in order for this to work properly but cant work out how to do that ?
e.g i have numbers 11.1, 11.8, 10.7 and i want to be able to group into those closest to 10.9 and those closest to 11.9

any ideas greatly appriciated.
 
Are you thinking of a range?

[tt] 9.5 to 10.4
10.5 to 11.4
11.5 to 12.4[/tt]
 
i want the query to display as -
nearest to 10.9 there are 12 numbers
nearest to 11.9 there are 3 numbers
nearest to 12.9 there are 23 numbers

etc...
although obviously it will display as a table not written out (hope that makes sense)
 
The partition function, is the best wany to count velues which fall into a distribuition of ranges. In your case, it would need some help, as it only counts "Whole" mumbers. To round your values to teh nearest 0.9, an approach would be to just multiply all the values by 10 and ROUND (a function in VBA) them. then use the PARTITION (another VBA function) - as long as the intervals you are using are evenly spaced. All necessary info is available via the ubiquitous {F1}[/volor]




MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top