Rounding Numbers

gigifarrow
gigifarrow used Ask the Experts™
on
I have a query that states : Scope: [Quantity]/11 & "%"

The answer I get back is :9.09090909090909E-02%

How would I make it say : 9%
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Declare a variable as an integer and assign it to that value.
Top Expert 2009

Commented:
What data type is the Quantity field?  If it is a numeric field, then you could format it as Percent, instead of appending a percent sign (which is text).  You can also select the number of decimal points to display; this is usually done in a textbox on a form or report, rather than in a query.
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
Quanity is a number.  so how would I put percentage? Like this :

Scope: Quantity]/11  "Percent"
Commented:
It would be:
Scope: Format([Quantity]/11,"Percent")

But if you want a precise whole number use the rounding function mention above along with the format function.

Author

Commented:
Scope: Format([Quantity]/11,"Percent") trbaze how would you divide 11 by quantity instead of quantity divided by 11

Commented:
Same way you would quantity by 11.  
Format(11/[Quantity],"Percent")

Remember that the percent format funtion will move the decimal two places.  So if 11 / 2 is 5.5, then doing the percent format will make it 550%.

Author

Commented:
okay Thank you for your help

Commented:
Your welcome.
You can also use the FormatPercent function and choose the number of decimals to display.  Both of these are listed in Access' built-in help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial