?
Solved

Fortmatting  a Percenatge in a text box

Posted on 2013-01-14
6
Medium Priority
?
357 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 34

Assisted Solution

by:Norie
Norie earned 500 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 500 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 500 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 500 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 49

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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

752 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