Allowable salary deductions

jackjoush
NewLounger
Posts: 19
Joined: 25 Mar 2021, 21:33

Allowable salary deductions

Post by jackjoush »

Hello everyone
If column A contains a date Less than the beginning of the Financial Year
divide column C by Number of days of the month then multiply in column B
and If column A contains a date between the beginning and end of the financial year
divide column D by Number of days of the month then multiply in column B

Code: Select all

Function Sanctions(dtm, dys, totals1, totals2)
    Dim sab As Long
    Dim md As Long
    Dim totals As Double
    sab = Year(DateAdd("m", 6, dtm))
    If sab = 2021 Then
        totals = totals1
    Else
        totals = totals2
    End If
    md = Day(DateSerial(Year(dtm), Month(dtm) + 1, 0))
    Sanctions = totals / md * dys
End Function
This UDF works fine but I need some modifications, so that the discount rate does not exceed 25% of the net salary for the current month
in column N .... The rest will be deducted in the coming months Until the amount to be deducted is over.
It would be appreciated if someone could kindly assist me in add some conditions to follow up on this ...Thank you in advance
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78439
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Allowable salary deductions

Post by HansV »

See the attached version.

Book1.xlsm
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

jackjoush
NewLounger
Posts: 19
Joined: 25 Mar 2021, 21:33

Re: Allowable salary deductions

Post by jackjoush »

Thanks a lot Mr. Hans
I think we need another function to do this automatically and put it in the cell I2
For more clarification ... please refer my attached sample file and in yellow cells that result that i wish..
Thank you so much for your time. Really appreciate that.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78439
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Allowable salary deductions

Post by HansV »

That's too complicated, sorry.
Best wishes,
Hans

jackjoush
NewLounger
Posts: 19
Joined: 25 Mar 2021, 21:33

Re: Allowable salary deductions

Post by jackjoush »

Thanks a lot Mr. Hans
I hope someone can help with this
Regards