How to Set Decimal Places in Format


D

doyle60

I have the following in a union query as one of the fields:

Format(Year1Qrt1MU,"Percent") AS [Qtr 1 %]

How do I get it to return only one decimal instead of two, as seems to
be its want?

Also, I have another field:

Year1Qrt1EV AS [Qtr 1 Sales]

How do I set it to return in Standard format with no decimal places?

I couldn't find the answer by googling, surprisingly,

Thanks,

Matt
 
Ad

Advertisements

O

onedaywhen

I have the following in a union query as one of the fields:

Format(Year1Qrt1MU,"Percent") AS [Qtr 1 %]

How do I get it to return only onedecimalinstead of two, as seems to
be its want?

Which rounding algorithm?

SELECT ROUND(0.05, 1)
returns 0 (banker's rounding).

SELECT FORMAT(0.05, '0.0') ' Arithmetic rounding
retuns '0.1' (rounds away from zero) .

Jamie.

--
 
Ad

Advertisements

D

doyle60

Onedaywhen, thanks for pointing out the two different ways to round.
Daman S., thanks but perhaps you forgot to multiply by 100. So, of
course, it is this:

Format(Year1Qrt1MU*100,"0.0") & "%" AS [Qtr 1 %]

Is there any thing bad about adding the "%" as if a text? Will I have
problems multiplying by the number in future queries, for example?
Will it still be a number?

The second question was not answered. I figured out from your above
response to make it this:

Format(Year1Qrt1EV,"#,#") AS [Qtr 1 Sales]

Is that okay? It seems to work.

Thanks,

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top