+ Reply to Thread
Results 1 to 8 of 8

Macro to help calculate the amount of payment and when it should be paid

  1. #1
    Registered User
    Join Date
    04-03-2022
    Location
    London, England
    MS-Off Ver
    Ms. Office 2013
    Posts
    79

    Exclamation Macro to help calculate the amount of payment and when it should be paid

    Hi all... I hope you're all in a great health.

    I'm faced with a problem...

    I lost my head thinking about this while doing this manually. So I have a monthly contribution for 1000+ employees dues that must be paid to vendor on either 2nd or 14th every month. But here's the thing:
    - If the starting date for the employee is on 2nd of the month, then the payment must be paid at the latest on the 2nd of the next month. For example, if the employee starts working on January 2nd, then the payment contribution must be paid at the latest on February 2nd. But there are many starting dates each month -- for example there are new employees on the 2nd, 15th, 20th of January.
    - It's a pain to make adhoc payments more than twice each month. So there will be a maximum two payments made each month, on the 2nd and 14th.
    - Since there are many starting dates and only two payment dates, we must group the other various dates into either the 2nd or 14th payment according to the closest payment date. For example: starting date 15th and 20th January will be paid in advance on the payment day 14th February. Starting date 1st January will be paid on payment day 2nd January.

    I have attached the sample of excel...
    The 'List' sheet is infinite. It should calculate as many employees as possible
    There are two kinds of contributions must be paid and it's based on the salary of the employee. I used VLOOKUP to determine the amount. The 'Total Contribution' is what each employee has to pay.
    There will be a 'Calculate' button in 'List' sheet that would calculate and determine if the employees' contribution would be paid on either 2nd or 14th of the next month. The result would show in 'Details' sheet
    There are salary changes, so the salary in 'List' sheet would change based on the salary changes inputted in 'Salary Change' sheet. I already made a dropdown list but can't quite make the IF function to show the salary based on the 'Salary Change' sheet... According to the month the list shows, the 'Calculate' button should be pressed and the correct amount shown in 'Details' sheet

    I'd really appreciate it if any of you could help me... Have a good day!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Macro to help calculate the amount of payment and when it should be paid

    So what are the date parameters for the 2 payment dates ?

    e,g starting on 23rd to 7th on the 2nd, starting on 8th to 22nd on the 14th
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    04-03-2022
    Location
    London, England
    MS-Off Ver
    Ms. Office 2013
    Posts
    79

    Re: Macro to help calculate the amount of payment and when it should be paid

    We're trying to maximize 14th as our final payment date so it should be:
    - 11th to 28th on 14th
    - 29th to 10th on 2nd

    Sometimes we even pay it adhoc on the starting date too... but onwards, it'll be included in the cycle of 2nd and 14th
    Last edited by nettadecoco; 08-11-2023 at 12:58 PM.

  4. #4
    Registered User
    Join Date
    07-26-2023
    Location
    Oklahoma
    MS-Off Ver
    365
    Posts
    57

    Re: Macro to help calculate the amount of payment and when it should be paid

    Here's a quick and dirty hack at this without VB code -- using Match, Index, CountIf and SumIf

    example.xlsm

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Macro to help calculate the amount of payment and when it should be paid

    in K5

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    in L5

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    in N5

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    =SUMPRODUCT(($A$2:$A$16>0)*((DAY(E2:$E$16)>=11)*(DAY($E$2:$E$16)<=28)))[/FORMULA]

    in O5

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-03-2022
    Location
    London, England
    MS-Off Ver
    Ms. Office 2013
    Posts
    79

    Re: Macro to help calculate the amount of payment and when it should be paid

    Hi John & Lastejp! Thank you for your response!

    It works, but how about the month part? I want the salary to automatically change according to the month in the 'Salary Change' sheet. Is there a way to automate it?

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Macro to help calculate the amount of payment and when it should be paid

    in F2

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-03-2022
    Location
    London, England
    MS-Off Ver
    Ms. Office 2013
    Posts
    79

    Re: Macro to help calculate the amount of payment and when it should be paid

    Thank you so much both of you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 08-26-2019, 05:42 PM
  2. [SOLVED] Calculate amount as per payment terms
    By rchure in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 08-21-2017, 07:56 AM
  3. Formula to calculate Amount Paid and Amount Past Due
    By TinaAlldredge in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-11-2016, 09:19 AM
  4. Calculate the dollar amount paid to each Payee
    By livemusic in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-01-2015, 04:35 PM
  5. [SOLVED] Calculate dollar amount paid if between a to and from amount
    By oxicottin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-21-2012, 08:01 PM
  6. Calculate loan amount when payment known.
    By Gschwaller in forum Excel General
    Replies: 1
    Last Post: 07-05-2012, 06:38 PM
  7. Replies: 6
    Last Post: 02-23-2010, 04:41 AM

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.6.0 RC 1