Solved

Fortmatting  a Percenatge in a text box

Posted on 2013-01-14
6
344 Views
Last Modified: 2013-02-15
I have the code below that when it calculates I get  a value of

21.440677966101694915254237288%  

 I need it to be 21.44%.

How do I get it to format with out messing up the calculation? The calcution does this:
1. Counts the number that is 100 percent done
2. then it sums  the percentage that is not 100% done
3. Totals those together (gives you 25.3)
4.then it divides that answer by 1.18


Here is the code:
=(DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18 & "%"
0
Comment
Question by:gigifarrow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 33

Assisted Solution

by:Norie
Norie earned 125 total points
ID: 38775602
Use Format.
=Format((DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18, "#.00%")

Open in new window

0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 125 total points
ID: 38775607
Format(21.440677966101694915254237288/100,"Percent")
returns 21.44%

So, in a text box:

=Format(YourNumber/100,"Percent")
0
 
LVL 9

Assisted Solution

by:shorvath
shorvath earned 125 total points
ID: 38775616
= Format(DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18, "0.##") & "%"
0
 
LVL 2

Accepted Solution

by:
rossdalangin earned 125 total points
ID: 38803890
Use the round function like:

=round(21.440677966101694915254237288,2)
output is 21.44

=round((DCount("[Percentage]","qrytemplePercentage"," [Unit ]= ('2-1AD')AND Percentage IN('100') ")+Nz(DSum("[Percentage]","qrytemplePercentage"," [Percentage ] NOT IN ('100') AND Unit =('2-1AD')" & " AND " & " Not IsNull (InShopDate)")/100))/1.18,2) & "%"
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 38895150
I've requested that this question be closed as follows:

Accepted answer: 168 points for imnorie's comment #a38775602
Assisted answer: 166 points for shorvath's comment #a38775616
Assisted answer: 166 points for DatabaseMX's comment #a38775607

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question