Format output as %

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Can you tell me if there is a way to cause a query to output a field in
percent format?

I have a query that calculates a range of summary values. Some of these
results are percents, which I currently calculate as
(B/A)*100=Percentage.

The results of this show a value like 28.20545. I would like them to
show as something like 28.2%.

Can you suggest a way to make this happen?

Thanks!

Scott
 
Open the query in design view, click on menu VIEW - Properties, click on you
output field, in the Format line type PERCENT. Remove the *100 from your
calculation.
 
Thanks for the fast response!

My query, unfortunately, is a SQL only query. As a result, I can't use
the design window. Is there a way to do this in SQL?
 
Here's the format of my query:

SELECT
A.[Leader Positions],
B.[Positions without backup],
(B.[Positions without backup]/A.[Leader Positions])*100 AS [Percent
without backup]

FROM
[SELECT Count([t_Eng Leadership Master].[Leader Name]) AS [Leader
Positions]
FROM (SELECT
DISTINCT [Leader Name]
FROM [t_Eng Leadership Master])
AS [Leadership Position Data]].
AS A,
[SELECT Count([t_Eng Leadership Master].[Leader Name]) AS
[Positions without backup]
FROM (SELECT
DISTINCT [Leader Name]
FROM [t_Eng Leadership Master]
WHERE [Candidate Name] IS NULL)
AS [Leadership Position Data]].
AS B;
 
Try this --
SELECT
A.[Leader Positions],
B.[Positions without backup],
(Format(B.[Positions without backup]/A.[Leader Positions]), “Percentâ€,2)
AS [Percent without backup]

The “Percentâ€,2 sets 2 decimal places.

Scott said:
Here's the format of my query:

SELECT
A.[Leader Positions],
B.[Positions without backup],
(B.[Positions without backup]/A.[Leader Positions])*100 AS [Percent
without backup]

FROM
[SELECT Count([t_Eng Leadership Master].[Leader Name]) AS [Leader
Positions]
FROM (SELECT
DISTINCT [Leader Name]
FROM [t_Eng Leadership Master])
AS [Leadership Position Data]].
AS A,
[SELECT Count([t_Eng Leadership Master].[Leader Name]) AS
[Positions without backup]
FROM (SELECT
DISTINCT [Leader Name]
FROM [t_Eng Leadership Master]
WHERE [Candidate Name] IS NULL)
AS [Leadership Position Data]].
AS B;

Thanks for the fast response!

My query, unfortunately, is a SQL only query. As a result, I can't use
the design window. Is there a way to do this in SQL?
 
Thanks!
KARL said:
Try this --
SELECT
A.[Leader Positions],
B.[Positions without backup],
(Format(B.[Positions without backup]/A.[Leader Positions]), "Percent",2)
AS [Percent without backup]

The "Percent",2 sets 2 decimal places.

Scott said:
Here's the format of my query:

SELECT
A.[Leader Positions],
B.[Positions without backup],
(B.[Positions without backup]/A.[Leader Positions])*100 AS [Percent
without backup]

FROM
[SELECT Count([t_Eng Leadership Master].[Leader Name]) AS [Leader
Positions]
FROM (SELECT
DISTINCT [Leader Name]
FROM [t_Eng Leadership Master])
AS [Leadership Position Data]].
AS A,
[SELECT Count([t_Eng Leadership Master].[Leader Name]) AS
[Positions without backup]
FROM (SELECT
DISTINCT [Leader Name]
FROM [t_Eng Leadership Master]
WHERE [Candidate Name] IS NULL)
AS [Leadership Position Data]].
AS B;

Thanks for the fast response!

My query, unfortunately, is a SQL only query. As a result, I can't use
the design window. Is there a way to do this in SQL?

KARL DEWEY wrote:
Open the query in design view, click on menu VIEW - Properties, click on you
output field, in the Format line type PERCENT. Remove the *100 from your
calculation.

:

Can you tell me if there is a way to cause a query to output a field in
percent format?

I have a query that calculates a range of summary values. Some of these
results are percents, which I currently calculate as
(B/A)*100=Percentage.

The results of this show a value like 28.20545. I would like them to
show as something like 28.2%.

Can you suggest a way to make this happen?

Thanks!

Scott
 

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

Back
Top