Hi,
I have a query that returns numbers that will go beyond 2 decimal places. I need it to be formatted to currency which I can do. The problem is that it rounds to the next highest decimal and I need it to cut off anything after 2 decimals. For example, 2077.9375 should return $2077.93 not $2077.94. Is this possible and if so how would I format it?
Thanks,
Leesha
Show 2 Decimal places without rounding
-
- BronzeLounger
- Posts: 1488
- Joined: 05 Feb 2010, 22:25
-
- StarLounger
- Posts: 80
- Joined: 24 Jan 2010, 13:09
- Location: Brantford, Ontario, Canada
Re: Show 2 Decimal places without rounding
Use the TRUNC function. =TRUNC(<reference>,2)
EDIT: Oops! Didn't realize this was the Access forum. I assumed Excel. Sorry!
EDIT: Oops! Didn't realize this was the Access forum. I assumed Excel. Sorry!
Last edited by StoneChucker on 21 Jun 2010, 15:20, edited 1 time in total.
-
- Administrator
- Posts: 78517
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Show 2 Decimal places without rounding
Let's say that the field containing the numbers is called Amount.
Create a calculated column in the query:
Amt: Int(100*[Amount])/100
This column will contain the values truncated to 2 decimal places instead of rounded. Format the column as Currency.
Create a calculated column in the query:
Amt: Int(100*[Amount])/100
This column will contain the values truncated to 2 decimal places instead of rounded. Format the column as Currency.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78517
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Show 2 Decimal places without rounding
Hi Chris,StoneChucker wrote:Use the TRUNC function. =TRUNC(<reference>,2)
TRUNC is an Excel worksheet function, it is not available in Access.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1488
- Joined: 05 Feb 2010, 22:25
Re: Show 2 Decimal places without rounding
PERFECT!!!
Thanks,
Leesha
Thanks,
Leesha
-
- 2StarLounger
- Posts: 164
- Joined: 10 Feb 2010, 12:53
Re: Show 2 Decimal places without rounding
Hi Hans,
I have a field in a table that I have designated as a currency format with 2 decimal places. However, indeed with any format I try, rounding still occurs. Very annoying - so how do I stop this please?
I have a field in a table that I have designated as a currency format with 2 decimal places. However, indeed with any format I try, rounding still occurs. Very annoying - so how do I stop this please?
-
- Administrator
- Posts: 78517
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Show 2 Decimal places without rounding
Sorry, I don't understand - how are the data rounded?
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 164
- Joined: 10 Feb 2010, 12:53
Re: Show 2 Decimal places without rounding
the data in question is 18.83, which rounds to 19.00. I have now changed the format to decimal with Auto decimal places. This seems to have retained the data at 18.83. Still very annoying.
-
- Administrator
- Posts: 78517
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Show 2 Decimal places without rounding
Strange - if you set the data type to Currency, the default format should be Currency and decimal places should be set to Auto. The field should then use your Windows setting for currency:
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans