Wrox Programmer Forums Calculate Percentage with Date
 |
 Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

January 29th, 2008, 07:07 AM
 mateenmohd Friend of Wrox Join Date: Jun 2003 Posts: 518 Thanks: 0 Thanked 0 Times in 0 Posts
Calculate Percentage with Date

It is possible to calculate the Percentage of project work
completed by given two dates ?

We have three fields in the form and table.

ACTUAL_STR_DATE DATE
COMPLETION_DATE DATE
WORK_COMPLETED TEXT

i.e.
actual_str_date 1/1/2007
completion_date 1/1/2008

if work completed in time, it means work_completed 100%

if work not completed in give date, i.e. work should be completed
in 1/1/2008 due to some reasons work not completed in time

then in work_completed field it show percentage of work completed
ie. 70 % or 80% or 90% an so on....

we can give formula in form field property that it calculate
the percentage of work completed ?

Thanks and regards
Mateen

January 29th, 2008, 09:45 AM
 mmcdonal Friend of Wrox Join Date: Mar 2004 Posts: 3,069 Thanks: 0 Thanked 10 Times in 10 Posts

Usually the work completed field is filled out by the project manager, and not calculated based on time. That would be a time burn rate, not a work completed calculation. If it is 7/1/2007, then you have burned 50% of your time, but you might not have done any work yet. Usually the values submitted are 25%, 50%, 75% and 100%. They are significant of various stages in project completion, so that users don't have to tease out 34.76%, for example.

That being said, do you want all days (364) or work days (260)?

The way you would do this is to calculate the number of days between your start and end dates, then calculate the number of days between your start date and today, then calculate the percentage of burned time like:

I wrote this little script to demonstrate based on total days:

dtStart = #01/01/2008#
dtEnd = #03/01/2008#
dtToday = Date()

iTotal = DateDiff("d", dtStart, dtEnd)
iBurn = DateDiff("d", dtStart, dtToday)

pBurn = iBurn/iTotal

It returns

iTotal = 60
iBurn = 28
pBurn = 0.466666666666667

Then display your results with a percent mask.

Does that help?

mmcdonal

Look it up at: http://wrox.books24x7.com

February 4th, 2008, 06:26 AM
 mateenmohd Friend of Wrox Join Date: Jun 2003 Posts: 518 Thanks: 0 Thanked 0 Times in 0 Posts

Thanks for your response.

It is very helpful.
We have to calculate 364 days.
Yes work completed fill by project manager.
it means that I have to create three date fields

1.strdate
2.insdate (inspection date)
3.enddate (work completed date)

mostly work delayed, work not completed in given date
ie. today date work should be completed, but due to some reasons
work delayed, in this case we have to
1. find work competed % ?
2. number of days work delayed ?

above code will use on mouse lost focus event of insdate form field
(Inspection date) ?

Thanks and regards
Mateen

 Similar Threads Thread Thread Starter Forum Replies Last Post How to calculate a number of days between 2 date windy417 Pro JSP 1 July 20th, 2006 07:09 PM how to calculate the percentage in sql yvr238 SQL Server 2000 1 May 13th, 2006 03:28 AM Calculate a difference percentage skwilliams Classic ASP Basics 15 April 4th, 2006 06:46 AM calculate date duration in asp.cet rjkulkarni2001 ASP.NET 2.0 Basics 2 January 13th, 2006 08:35 AM percentage darkhalf Javascript 2 October 28th, 2005 02:55 PM

 Contact Us - Wrox - Privacy Statement - Top