Solved

Fortmatting  a Percenatge in a text box

Posted on 2013-01-14
6
308 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
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 - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) 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 45

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now