+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Thumbs up If dates return value

    Hi again,

    I think I lost my post. But anyway, sorry to be back again but I have a tedious work that I think can be done with the right formula. I have a start & end date and I need to post an amount every let's say 60 days from start to finish. I have already the formula for calculating the days of each month but I just need to insert the condition in the formula. I've attached the file which explains better what I need.

    Thanks once again for all your help.
    Attached Files Attached Files
    Last edited by rickyilas; 03-09-2010 at 08:21 AM.

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: If dates return value

    If (big IF) I've understood:

    E7: =IF(OR($C7>E$6,$D7<E$6),0,$C$3*OR($C7=E$6-DAY(E$6)+1,MOD(FLOOR(E$6-$C7,30),$C$4)=0))
    copied across

    For your second example - the same formula as above but with an additional test in the 2nd OR of $D7=E$6
    (references altered of course)
    Last edited by DonkeyOte; 03-06-2010 at 07:40 AM. Reason: changed constant 90 to $C$4

  3. #3
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: If dates return value

    DO!!! hahaha....it works! unbelievable...Thanks again!

    Below is the 2nd formula for the sake of others who may find this example useful.

    =IF(OR($C18>E$17,$D18<E$17),0,$C$3*OR($C18=E$17-DAY(E$17)+1,$D18=E$17,MOD(FLOOR(E$17-$C18,30),$C$4)=0))

    Cheers :-)

  4. #4
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: If dates return value

    Hi DO! I was doing some experiment on 75 days and it's not giving me the right result. I've attached an updated file maybe you can check again. Tnx.
    Attached Files Attached Files

  5. #5
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: If dates return value

    Correct - the prior suggestion was based on 75 days.

    Perhaps the below might work though in truth I've not really tested in full and it has limited scope (ie assumes days always >=1 month - ie result never a multiple of C4, C21)

    Code:
    F7:
    =IF(OR($C7>F$6,$D7<(F$6-DAY(F$6)+1)),0,$C$3*(MOD(F$6-$C7,$C$4)<DAY(F$6)))
    copied across
    
    F21:
    =IF(OR($C21>F$20,$D21<(F$20-DAY(F$20)+1)),0,$C$17*OR(DATE(YEAR($D21),MONTH($D21)+1,0)=F$20,MOD(F$20-$C21,$C$18)<DAY(F$20)))
    copied across
    To reiterate though - I don't think the above is ideal.

    It can be more difficult than you expect when you use days rather than months - eg every 30 days from 31 Jan would mean no collection in Feb - is this desired etc etc ?

  6. #6
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: If dates return value

    Hi DO, thanks for the reply. The formula has to start in column E (Jan) and I made some test on the days and unfortunately it's not giving the correct result. It has to count exactly the number of days in each month. The reason I use days is because the rotation of each person varies e.i. (75 days work or 90 days or 21 days) It's never an exact monthly rotation. The days must be calculated from Start (how many days in the starting month) also how many days in the finish month to compute the N days.

    If it is possible not to use macro on this pls.

  7. #7
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: If dates return value

    Regards commencement in E - simply copy the formula provided from F7 to E7 (F21 to E21).

    Please provide an example illustrating errors... the formulae worked for me.

    On an aside what happens on a 21 day rotation - presumably in certain months you would need to duplicate the C3 value, no ?
    Last edited by DonkeyOte; 03-08-2010 at 05:05 AM.

  8. #8
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: If dates return value

    Hi DO,

    Pls. find attached revised spreadsheet which shows supposed values. I noticed that it is the # of days between Jan1 to March31 which is supposed to be 90days but in your calculation it's just 89days so it's shifting to April. Minor problem but if it can still be amended would be perfect.

    Scenario 1 of 42 days the last date should be zero because it's not up to 42 days.

    For now the minimum rotation is 42 days so no need to calculate possibilities of double booking in certain months but it would be interesting if there's a formula to show flexibility in such criteria.
    Attached Files Attached Files

  9. #9
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: If dates return value

    I've not looked at this in depth as yet but at first glance I would say we need to establish something fairly fundamental...

    Should the day upon which an amount is invoked be included or excluded from the rolling days ?

    eg your file shows 31 days in E9 for Jan 2010 as opposed to 30 ... given 34k is invoked on the 1st of the month should that date not be discounted - ie 30 days used up of the next 90 days.

  10. #10
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: If dates return value

    You're right! That 1st day of Jan2010 should not be counted as 34K is already posted on that day. Therefore count starts the following day.

    Could you pls. do something about scenario 1 (42 days)? The last month (Feb2011) should be zero.

    If it's not much to ask, making the formula flexible if ever criteria is 21 days so there will be double booking in certain months.

  11. #11
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: If dates return value

    OK by my reckoning the below should work for the first scenario irrespective of interval period - and to reiterate the "rolling days" commences the day after last payment date.

    Code:
    E7:
    =IF(OR($C7>E6,$D7<(E6-DAY(E6)+1)),0,$C3*IF(DATE(YEAR($C7),MONTH($C7)+1,0)=E6,1+INT((E6-$C7)/$C4),INT((MOD(MAX(0,(E6-DAY(E6))-$C7),$C4)+DAY(MIN($D7,E6)))/$C4)))
    copied across to AB7
    E7:AB7 can be copied directly to E20:AB20

    I will put together another variant for the second scenario which incorporates the need / potential for multiple amount in final period and will post later.

  12. #12
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: If dates return value

    ricyilas, suspect we may have scared you off

    FWIW - I had a quick look at this again just now re: scenario 2 and I *believe* the below should work:

    Code:
    E38:
    =IF(OR($C38>E37,$D38<(E37-DAY(E37)+1)),0,$C34*IF(DATE(YEAR($C38),MONTH($C38)+1,0)=E37,1+INT((E37-$C38)/$C35),MAX(DATE(YEAR($D38),MONTH($D38)+1,0)=E37,INT((MOD(MAX(0,(E37-DAY(E37))-$C38),$C35)+DAY(MIN($D38,E37)))/$C35))))
    the assumption in the above is that the multiple for the final month will be the greater of 1 and the standard multiple (ie should 2 payments be required in the final month).

  13. #13
    Registered User
    Join Date
    08-24-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: If dates return value

    DO! I thought you have abandon me....hehehehe....

    I've checked and the formulas works perfectly as expected....Thanks!!!!

    I've attached an updated file for the sake of those who may find this interesting.

    till next time...ciao!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0