Pricing by volume tier

BMil8

Board Regular
Joined
Aug 9, 2010
Messages
153
Office Version
  1. 365
I'm stumped on a formula. We have a tiered pricing model based on volume. I'm trying to create a table that breaks the YTD volume into the appropriate tier by month. Basically in the example below, the first 235,000 YTD are charged at a certain price, then 235,001-500,000 at a different price and so on. I'd just like a formula in the highlighted area to place the volume in the appropriate column. Did I give enough of an explanation?



Book9
BCDEFGHI
30235,001500,0012,000,001
4MonthYTD LinksNew by Month235,000500,0002,000,0005,000,000Total
5Jan217,569217,569217,569000217,569
6Feb237,56519,99617,4312,5650019,996
7Mar248,96311,398011,3980011,398
8Apr304,85655,893055,8930055,893
9May385,00080,144080,1440080,144
10Jun499,521114,5210114,52100114,521
11Jul608,976109,4550109,45500109,455
12Aug757,939148,9630126,02422,9390148,963
13Sep1,459,653701,71400701,7140701,714
14Oct3,059,7851,600,132001,275,347324,7851,600,132
15Nov4,148,9641,089,1790001,089,1791,089,179
16Dec6,598,6542,449,6900002,449,6902,449,690
17235,000500,0002,000,0003,863,6546,598,654
Sheet1
Cell Formulas
RangeFormula
F3:H3F3=E4+1
C11C11=C10+109455
C12C12=C11+148963
D5D5=C5
D6:D16D6=C6-C5
I5:I17I5=SUM(E5:H5)
E17:H17E17=SUM(E5:E16)
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Why don't you calculate the price based on the cumulative sales?
There are many versions of tiered pricing on this forum.
If I provide a suggestion, will you review it?
 
Upvote 0
Why don't you calculate the price based on the cumulative sales?
There are many versions of tiered pricing on this forum.
If I provide a suggestion, will you review it?
Thanks, but I'm not sure I understand your question. We bill each month based on new volume, using the tier each unit would fall in based on the YTD number. Meaning if there were 20K sold in November, and 600K sold from Jan-Nov, we would create an invoice for the 20K units, but using the price associated with the 600K. Regardless, I'm just looking for a formula to replicate what I have manually entered in the highlighted section above.
 
Upvote 0
We bill each month based on new volume, using the tier each unit would fall in based on the YTD number.

OK
I just thought you may want to do the calculation with one formula.
 
Upvote 0
You can do it with the following VBA code.

EXCEL
BCDEFGHI
30235,001500,0012,000,001
4MonthYTD LinksNew by Month235,000500,0002,000,0005,000,000Total
5Jan217,569217,569217,569000217,569
6Feb237,56519,99617,4312,5650019,996
7Mar248,96311,398011,3980011,398
8Apr304,85655,893055,8930055,893
9May385,00080,144080,1440080,144
10Jun499,521114,5210114,52100114,521
11Jul608,976109,4550109,45500109,455
12Aug757,939148,9630126,02422,9390148,963
13Sep1,459,653701,71400701,7140701,714
14Oct3,059,7851,600,132001,275,347324,7851,600,132
15Nov4,148,9641,089,1790001,089,1791,089,179
16Dec6,598,6542,449,6900002,449,6902,449,690
17235,000500,0002,000,0003,863,6546,598,654
Sheet1
Cell Formulas
RangeFormula
F3:H3F3=E4+1
C11C11=C10+109455
C12C12=C11+148963
D5D5=C5
D6:D16D6=C6-C5
I5:I16I5=SUM(K5:N5)
E17:H17E17=SUM(K5:K16)
I17I17=SUM(E17:H17)


VBA Code:
Sub Tier()
Dim r As Range:         Set r = Range("E5:H16")
Dim AR() As Variant:    AR = Range("D5:D16").Value2
Dim RES() As Variant:   RES = Evaluate(Replace("=IF(ISERROR(@),0,0)", "@", r.Address))
Dim Tiers As Variant:   Tiers = Range("E4:H4")
Dim COL As Integer:     COL = 1
Dim Total As Long:      Total = 0


For i = 1 To UBound(AR)
    Total = Total + AR(i, 1)
    If Total > Tiers(1, COL) Then
        RES(i, COL + 1) = Total - Tiers(1, COL)
        RES(i, COL) = AR(i, 1) - RES(i, COL + 1)
        Total = RES(i, COL + 1)
        COL = COL + 1
    Else
        RES(i, COL) = AR(i, 1)
    End If
Next i

r.Value = RES
End Sub
 
Upvote 0
You can do it with the following VBA code.

EXCEL
BCDEFGHI
30235,001500,0012,000,001
4MonthYTD LinksNew by Month235,000500,0002,000,0005,000,000Total
5Jan217,569217,569217,569000217,569
6Feb237,56519,99617,4312,5650019,996
7Mar248,96311,398011,3980011,398
8Apr304,85655,893055,8930055,893
9May385,00080,144080,1440080,144
10Jun499,521114,5210114,52100114,521
11Jul608,976109,4550109,45500109,455
12Aug757,939148,9630126,02422,9390148,963
13Sep1,459,653701,71400701,7140701,714
14Oct3,059,7851,600,132001,275,347324,7851,600,132
15Nov4,148,9641,089,1790001,089,1791,089,179
16Dec6,598,6542,449,6900002,449,6902,449,690
17235,000500,0002,000,0003,863,6546,598,654
Sheet1
Cell Formulas
RangeFormula
F3:H3F3=E4+1
C11C11=C10+109455
C12C12=C11+148963
D5D5=C5
D6:D16D6=C6-C5
I5:I16I5=SUM(K5:N5)
E17:H17E17=SUM(K5:K16)
I17I17=SUM(E17:H17)


VBA Code:
Sub Tier()
Dim r As Range:         Set r = Range("E5:H16")
Dim AR() As Variant:    AR = Range("D5:D16").Value2
Dim RES() As Variant:   RES = Evaluate(Replace("=IF(ISERROR(@),0,0)", "@", r.Address))
Dim Tiers As Variant:   Tiers = Range("E4:H4")
Dim COL As Integer:     COL = 1
Dim Total As Long:      Total = 0


For i = 1 To UBound(AR)
    Total = Total + AR(i, 1)
    If Total > Tiers(1, COL) Then
        RES(i, COL + 1) = Total - Tiers(1, COL)
        RES(i, COL) = AR(i, 1) - RES(i, COL + 1)
        Total = RES(i, COL + 1)
        COL = COL + 1
    Else
        RES(i, COL) = AR(i, 1)
    End If
Next i

r.Value = RES
End Sub
This works great thanks. I didn't even realize you could use VBA for things like this.
 
Upvote 0
N.B. You did not provide the rates for each tier. The rates are shown in the next post.
This example does not require a macro enable file.
Commissions 2023.xlsm
ABC
1Version a
2SalesPrice
3January217,569.0010,878.45
4February237,565.00948.50
5March248,963.00341.94
6April304,856.001,676.79
7May385,000.002,404.32
8June499,521.003,435.63
9July608,976.002,193.89
10August757,939.002,979.26
11September1,459,653.0014,034.28
12October3,059,785.0021,404.79
13November4,148,964.0010,891.79
14December6,598,654.0024,496.90
1595,686.54
2h
Cell Formulas
RangeFormula
B9B9=B8+109455
B10B10=B9+148963
C3:C14C3=Pricing_a(B3)-SUM($C$2:C2)
C15C15=SUM(C3:C14)
Lambda Functions
NameFormula
Pricing_a=LAMBDA(CumRev,LET(b, {0;235000;500000;2000000}, r, {0.05;-0.02;-0.01;-0.01}, SUM((CumRev > b) * (CumRev - b) * r)))
 
Upvote 0
Commissions 2023.xlsm
ABCEF
1Version aVersion bCumulative
2SalesPricePricePrice
3January217,569.0010,878.4510,878.4510,878.45
4February237,565.00948.50948.5011,826.95
5March248,963.00341.94341.9412,168.89
6April304,856.001,676.791,676.7913,845.68
7May385,000.002,404.322,404.3216,250.00
8June499,521.003,435.633,435.6319,685.63
9July608,976.002,193.892,193.8921,879.52
10August757,939.002,979.262,979.2624,858.78
11September1,459,653.0014,034.2814,034.2838,893.06
12October3,059,785.0021,404.7921,404.7960,297.85
13November4,148,964.0010,891.7910,891.7971,189.64
14December6,598,654.0024,496.9024,496.9095,686.54
1595,686.5495,686.54
16
17Total6,598,654.0095,686.5495,686.54
18
19
20BracketsRatesTierArithmetic Cumulative orArithmetic
21
2205.00%235,000.0011,750.0011,750.00
23235,0003.00%265,000.0019,700.007,950.00
24500,0002.00%1,500,000.0049,700.0030,000.00
252,000,0001.00%4,598,654.0095,686.5445,986.54
261.E+3080.50%
27
28Amount6,598,654.0095,686.5495,686.54
29
2h
Cell Formulas
RangeFormula
B9B9=B8+109455
B10B10=B9+148963
F3:F14F3=Pricing_a(SUM(B3))
C3:C14C3=Pricing_a(B3)-SUM($C$2:C2)
C15,E15C15=SUM(C3:C14)
E3:E14E3=LET(s,B3,b,{0;235000;500000;2000000},r,{0.05;-0.02;-0.01;-0.01},SUM((s>b)*(s-b)*r)-SUM($E$2:E2))
B17B17=B14
C17C17=Pricing_a(B17)
E17E17=SUM((B17>{0;235000;500000;2000000})*(B17-{0;235000;500000;2000000})*{0.05;-0.02;-0.01;-0.01})
E22:E25E22=MAX(0,MIN($B$28-A22,A23-A22))*B22+E21
F22:F25F22=MAX(0,MIN($B$28-A22,A23-A22)*B22)
C22:C25C22=MAX(0,MIN($B$28-A22,A23-A22))
A26A26=BigNum
B28B28=B17
E28E28=MAX(E22:E25)
F28F28=SUM(F22:F26)
Lambda Functions
NameFormula
Pricing_a=LAMBDA(CumRev,LET(b, {0;235000;500000;2000000}, r, {0.05;-0.02;-0.01;-0.01}, SUM((CumRev > b) * (CumRev - b) * r)))
 
Upvote 0
or
Cell Formulas
RangeFormula
I3I3=BigNum
D5D5=C5
E5:H16E5=MAX(MAX(0,MIN($C5-E$3,F$3-E$3))-SUM(E$4:E4),0)
I19,I5:I17I5=SUM(E5:H5)
J5:J16J5=Pricing_a(C5)-SUM($J$4:J4)
D6:D16D6=C6-C5
C11C11=C10+109455
C12C12=C11+148963
E17:H17E17=SUM(E5:E16)
E19:H19E19=E17*E18
J19J19=SUM(J5:J16)
 
Upvote 0
You can do it with the following VBA code.

EXCEL
BCDEFGHI
30235,001500,0012,000,001
4MonthYTD LinksNew by Month235,000500,0002,000,0005,000,000Total
5Jan217,569217,569217,569000217,569
6Feb237,56519,99617,4312,5650019,996
7Mar248,96311,398011,3980011,398
8Apr304,85655,893055,8930055,893
9May385,00080,144080,1440080,144
10Jun499,521114,5210114,52100114,521
11Jul608,976109,4550109,45500109,455
12Aug757,939148,9630126,02422,9390148,963
13Sep1,459,653701,71400701,7140701,714
14Oct3,059,7851,600,132001,275,347324,7851,600,132
15Nov4,148,9641,089,1790001,089,1791,089,179
16Dec6,598,6542,449,6900002,449,6902,449,690
17235,000500,0002,000,0003,863,6546,598,654
Sheet1
Cell Formulas
RangeFormula
F3:H3F3=E4+1
C11C11=C10+109455
C12C12=C11+148963
D5D5=C5
D6:D16D6=C6-C5
I5:I16I5=SUM(K5:N5)
E17:H17E17=SUM(K5:K16)
I17I17=SUM(E17:H17)


VBA Code:
Sub Tier()
Dim r As Range:         Set r = Range("E5:H16")
Dim AR() As Variant:    AR = Range("D5:D16").Value2
Dim RES() As Variant:   RES = Evaluate(Replace("=IF(ISERROR(@),0,0)", "@", r.Address))
Dim Tiers As Variant:   Tiers = Range("E4:H4")
Dim COL As Integer:     COL = 1
Dim Total As Long:      Total = 0


For i = 1 To UBound(AR)
    Total = Total + AR(i, 1)
    If Total > Tiers(1, COL) Then
        RES(i, COL + 1) = Total - Tiers(1, COL)
        RES(i, COL) = AR(i, 1) - RES(i, COL + 1)
        Total = RES(i, COL + 1)
        COL = COL + 1
    Else
        RES(i, COL) = AR(i, 1)
    End If
Next i

r.Value = RES
End Sub
I just realized this doesn't work exactly as needed. You can see in column F the total is the entire 500,000 when it should just include (500,000-235,001) = 264,999 that fall within that range. What do I need to adjust?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top