Lookup multiple customers and apply their respective slabs

amandeep08

Board Regular
Joined
Mar 20, 2011
Messages
130
Office Version
  1. 365
Hi All,

I have 100+ customers and each one is having different commission slabs. I want the formula which will match the customer name and apply the respective slabs on the sales done by them.

I have tried multiple formulas but not able to get success. Apart from this, i have tried putting the slabs in a cell without equal sign and tried to ccalculate the same basis the lookup value but it also not worked. Pl help me
 
For the formula version I posted, here is how it would be adapted to the revised table structure. Check the values to confirm that the results are as expected. I see that you have changed the tier limits so that one ends where the next begins. So the formula could be simplified a little bit by using the start slab values, but in this version, I've left the method unchanged...to shift the end slab index by 1 and insert a 0 for the first tier...and then use that array as the start slab (and it would look just like your current start slabs).

Edit: The simplified version is also shown, where we use the Start Slab values directly since there is no discontinuity between tiers. Also, I noted an error in the slab table (see green cell with red font).
MrExcel_20240301.xlsx
ABCDEFGHIJKL
1Customer NameCustomer Category Sales CommissionCustomer NameCustomer CategoryStart SlabEnd Slab% Margin
2AReseller8250007525.00AReseller05000000.01
3BCorporate122500011887.50AReseller5000007500000.008
4CEmployee7350009100.00AReseller75000010000000.007
5AReseller10000000.006
6BCorporate010000000.01
7AReseller8250007525.00BCorporate100000012000000.0085
8BCorporate122500011887.50BEmployee12000000.0075
9CEmployee7350009100.00CEmployee02000000.015
10CEmployee2000005000000.0125
11CEmployee50000010000000.01
12CEmployee10000000.0075
Sheet7
Cell Formulas
RangeFormula
D2:D4D2=LET(slab,$H$2:$L$12,cslab,FILTER(slab,CHOOSECOLS(slab,1)=A2),csslab,VSTACK(0,DROP(CHOOSECOLS(cslab,4),-1)),ccom,CHOOSECOLS(cslab,5),ccom_shft,VSTACK(0,DROP(ccom,-1)),res, SUMPRODUCT(--(C2>csslab),(C2-csslab),(ccom-ccom_shft)), res)
D7:D9D7=LET(slab,$H$2:$L$12,cslab,FILTER(slab,CHOOSECOLS(slab,1)=A7),csslab,CHOOSECOLS(cslab,3),ccom,CHOOSECOLS(cslab,5),ccom_shft,VSTACK(0,DROP(ccom,-1)),res, SUMPRODUCT(--(C7>csslab),(C7-csslab),(ccom-ccom_shft)), res)
 
Last edited:
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
The suggestions posted previously still may be relevant.
To make the data entry easier, I included the Lambda version which requires Excel 365.
The first formula is on one row and the information is derived from the Rate Table but doesn't require the Table.
Provide the function with a user friendly name. The function indicates the required parameters.

Commissions 2024.xlsm
ABCDEFGHIJKLMNOPQRSTU
1
2AReseller825,0007,525.007,525.000500,000750,0001,000,0000.01-0.002-0.001-0Customer NameCustomer CategoryStart Slab% Margin
3AReseller01.00%
4AReseller500,0000.80%
5AReseller750,0000.70%
6AReseller1,000,0000.60%
7BCorporate01.00%
8BCorporate1,000,0000.85%
9BEmployee1,200,0000.75%
10CEmployee01.50%
11CEmployee200,0001.25%
12CEmployee500,0001.00%
13CEmployee1,000,0000.75%
14
1h
Cell Formulas
RangeFormula
D2D2=SUM((C2>G2:K2)*(C2-G2:K2)*(M2:Q2))
E2E2=Commission_(A2,$R$2:$U$13,C2)
Lambda Functions
NameFormula
Commission_=LAMBDA(CustomerName,rngRateInformation,Sales,LET(n,CustomerName,s,Sales,slab,rngRateInformation,cslab,FILTER(slab,CHOOSECOLS(slab,1)=n),csslab,CHOOSECOLS(cslab,3),ccom,CHOOSECOLS(cslab,4),ccom_shft,VSTACK(0,DROP(ccom,-1)),SUM((s>csslab)*(s-csslab)*(ccom-ccom_shft))))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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