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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to round up a percentage calculated in a query 1

Status
Not open for further replies.

elinorigb

Technical User
Jun 21, 2004
15
US
Hi,

I have a query that calculates percentages for a group of employees, grouped by department. The goal was to have results that looked something like this:

# Employees DEPT Percentage of Respondents
228 Operations 28.78
215 Corporate 27.14

The query is working well, but right now its showing percentages such as 28.78787878. Is there a way, within the query that I can round to the nearest tenth or hundredth? Here's my query:

SELECT 100*[qryDept].[CountOfdept]/792 AS Percentage, qryDept.dept, qrydept.CountOfdept
FROM qrydept
GROUP BY qrydept.dept, qrydept.CountOfdept
ORDER BY qrydept.CountOfdept DESC;

Thanks in advance!
 

Not too sure how to do this in SQL, but you can right click on the field and set the number of decimal places in the Access query editor. This will only change the view. The number will still be 28.78787878 if you copy it.
 
Something like this ?
SELECT Round(100*[qryDept].[CountOfdept]/792, 2) AS Percentage

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top