+ Reply to Thread
Results 1 to 11 of 11

Progressive calculation based on date and months

  1. #1
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Progressive calculation based on date and months

    RE attached file.
    I would like any hours (Column K) with an “ST” result (Column G) to recalculate on the following criteria.

    Based on the current month/date:
    The hours in column K need to be divided by the number of month’s “From” and “To” columns D and E.
    Then multiplied by the months that have passed.

    Example is Row 4.
    Months are “From” January “To” May which is a total of 5 months.
    The total hours are 20.
    The formula needs to divide the hours by 5 months, which equals 4 hours per month.
    The current month is February, which means my adjusted hours (column N) should show 8. This is 4 for January and 4 for February.

    At line 11, 80 hours, divided by 8 months equals 10 hours per month.
    Current month is February, so the adjusted hours should be 20 hours.

    The current date can be inserted at Reference O2.
    Data in the report will change from month to month and needs to be updated on an ongoing basis.
    I hope someone can help me out here.
    Thanks in anticipation
    Chris
    Attached Files Attached Files
    Last edited by Christopherdj; 02-12-2012 at 07:09 PM. Reason: Rylo to the rescue once more

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Progressive calculation based on date and months

    Hi

    N2: =IF(G2<>"ST","",K2/(MONTH(E2)-MONTH(D2)+1)*MONTH($O$2))

    HTH

    rylo

  3. #3
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Re: Progressive calculation based on date and months

    As per usual - a promt response with a correct outcome.
    Rylo - brilliant as usual. Thanks Heaps.

    Found a glitch - if you change result in first line to ST, it provides me with a total of 40.
    this is incorrect. The multiplier is x 5 (as May is the 5th month), but it should only count the month as 1, because the start month and end month are the same = 1.

    The hours allocated is a maximum, but is divided by the number of months it covers from start to finish.

    I hope this expanation is clear enough.
    Last edited by Christopherdj; 02-10-2012 at 12:46 AM.

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Progressive calculation based on date and months

    Hi

    Should the result actually be 0 as the current date is before the start date? If not, then what should the result really be, and how is it calculated?

    rylo

  5. #5
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Re: Progressive calculation based on date and months

    Hey Rylo

    Its all about payment really, one would anticipate no ST results would appear before a starting date.
    They should appear either on or just after, however they may not change for any period of time after that.

    Based on 20 hours as an example.
    The concept is - payments are based on an ST to start it off, which is based on the number of months between the start and end dates, so:

    Example 1
    If it is one month (February start and end dates)
    then calculation would be hours/months*per month (20/1*1=20) but always only to the maximum total.

    Example 2
    If start and end dates (20 hours) are over 2 months - say Feb and March,
    then we have hours/months*per month
    In February it would be 20/two months*one month = 10
    In March it would be 20/two months*2 months = 20

    Example 3
    For a unit of 90 hours with start and end dates covering Apr, May, June
    in April it would be 30,
    May it would be 60 and
    in June it would total out 90

    I hope this makes the query clearer.
    regards
    Last edited by Christopherdj; 02-10-2012 at 02:28 AM.

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Progressive calculation based on date and months

    Hi

    So it really doesn't have anything to do with the date in O2, it really relates to the start and end date, and spreads the hours across those months??

    rylo

  7. #7
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Re: Progressive calculation based on date and months

    Yes, but it then calculates against the current month to determine how much is allocated at that point in time.

  8. #8
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Progressive calculation based on date and months

    So it should only perform some calc if the date in O2 >= the start date? It shouldn't do anything if the date in O2 is < start date?

  9. #9
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Re: Progressive calculation based on date and months

    A "ST" will/should not occur prior to a start date, and yes you are correct
    it should only perform some calc if the date in O2 >= the start date.
    It shouldn't do anything if the date in O2 is < start date.

    In example 3 above, if the report date (O2) was run in March - and an ST was entered against the unit, because the start date is in the future, then I really don't need a result as it won't get paid until after the start date (which would be when I run the report in the commencement month - in this case April).

    If the report was run in July or later, then it would give me a result of 90 no matter what month I place in O2.

  10. #10
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Progressive calculation based on date and months

    Hi

    OK, try this

    N2: =IF(OR(G2<>"ST",$O$2<D2),"",MIN(K2,K2/(MONTH(E2)-MONTH(D2)+1)*(MONTH($O$2)-MONTH(D2)+1)))

    rylo

  11. #11
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Re: Progressive calculation based on date and months

    Thanks Rylo.
    It seems to work ok.
    I'll run the reports for this year and see how we go.
    Thanks for you assitance, obviously the criteria was a little confusing - all seems well though.
    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1