What are the fields you want to have as input and variables and what are the expected output fields. I understand the whole add sub dilemma but need to know what you want as input and output.
gowflow
Function QuarterlyBonus(PriorSales As Double, CurrentSales As Double, Quota As Double, SalesBrackets As Range, BonusPercent As Range) As Double
Dim i As Long, j As Long, n As Long
Dim Amount, Bonus As Double, Base As Double, Rate As Double
n = SalesBrackets.Cells.Count
If CurrentSales > Quota Then
Base = PriorSales + Quota
i = Application.Match(Base, SalesBrackets, 1)
For j = i To n
If j < n Then
Amount = Application.Min(SalesBrackets.Cells(j + 1).Value, PriorSales + CurrentSales) - Base
Base = SalesBrackets.Cells(j + 1).Value
Else
Amount = CurrentSales - Base
End If
If Amount > 0 Then Bonus = Bonus + Amount * BonusPercent.Cells(j).Value
Next
End If
QuarterlyBonus = Bonus
End Function
Title | # Comments | Views | Activity |
---|---|---|---|
Macro to Send Appointment from Excel | 1 | 30 | |
problem with vb editor in excel 2016 | 10 | 26 | |
Excel - Row Height +1 VBA | 2 | 24 | |
Name Rotation | 11 | 29 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!