+ Reply to Thread
Results 1 to 6 of 6

Frequency

Hybrid View

  1. #1
    Registered User
    Join Date
    10-15-2008
    Location
    Coventry
    MS-Off Ver
    2003
    Posts
    70

    Frequency

    Hi,

    I am trying to populate cells O-BJ with the invoice amount based on the period and frequency.

    So Cell A5 would appear every 11 months for 100, and A8 every month from November11 onwards.

    Help
    Attached Files Attached Files
    Last edited by lky2k23; 10-28-2011 at 04:35 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Re: Frequency

    Not 100% sure I know exactly what you mean, but is the attached about right?
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-15-2008
    Location
    Coventry
    MS-Off Ver
    2003
    Posts
    70

    Re: Frequency

    Not really no sorry.

    I will try to be clear :-/

    The value in D5 needs to appear in the month J5 says (January 2012) and then again 11months (H5).

    The value in D8 would appear in every month from November 2010

    Hope this helps - thanks for trying.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Frequency

    Try this formula in O5 copied across and down

    =IF($J5-DAY($J5)+1>DATE(O$3,O$2,1),"",IF(MOD(DATEDIF($J5-DAY($J5)+1,DATE(O$3,O$2,1),"M"),$H5)=0,$D5,""))
    Audere est facere

  5. #5
    Registered User
    Join Date
    10-15-2008
    Location
    Coventry
    MS-Off Ver
    2003
    Posts
    70

    Re: Frequency

    perfect - thank you. Wow that seems in depth. Will I ever not need help?

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Frequency

    It's probably not as complex as it first seems. The idea is to find the number of months between J5 and the current column header.

    To get a difference in months between two dates, in general, you can use DATEDIF like this

    =DATEDIF(Y1,Z1,"M")

    where Y1 and Z1 are dates and Y1 is the earlier date of the two,

    So here you can get the first of the month from the data in O2 and O3 with

    =DATE(O$3,O$2,1)

    and, because the column J dates are not always 1st of the month you can convert a date in J5 to the first of that month by using

    =$J5-DAY($J5)+1

    Note that in the DATE function the $ signs are before the row numbers, in the latter part ($J5-DAY($J5)+1) they are before the column letters. This allows the formula to be dragged across and down with the relevant part only changing ($J5 changes to $J6 when dragged down but stays as $J5 when dragged across whereas O$3 stays as O$3 when dragged down but changes to P$3 etc when dragged across)

    ....so now we have the difference in months with

    =DATEDIF($J5-DAY($J5)+1,DATE(O$3,O$2,1),"M")

    Now you want the payment triggered every n months with n being the number in H5 so if we use MOD like this

    =MOD(DATEDIF($J5-DAY($J5)+1,DATE(O$3,O$2,1),"M"),$H5)

    that returns the remainder when the month difference is divided by the number in H5, so if H5 is 11 that will always return zero as the remainder when the month difference is divisble by 11, so we get zero on the months that you want the payment paid, month 11, 22, 33 etc......so we check if the above returns zero and if it does the figure from D5 is returned, otherwise a blank, so that becomes

    =IF(MOD(DATEDIF($J5-DAY($J5)+1,DATE(O$3,O$2,1),"M"),$H5)=0,$D5,"")

    That would be sufficient except sometimes the first date in DATEDIF, $J5-DAY($J5)+1 is a later date than DATE(O$3,O$2,1)....in which case DATEDIF returns a #NUM! error so we have an extra IF to suppress that error. If $J5-DAY($J5)+1 is > DATE(O$3,O$2,1) we also want a blank so we add the additional IF function to check that

    QED

+ 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