Splitting Commission IF

greekexcel

New Member
Joined
Oct 31, 2022
Messages
32
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone.
I have this table that calculates and splits the commission between sales reps.
Each salesrep has a different commission percentage(you can see it above his name)
DEMO FOR VBA1.xlsx
ABCDEFGHIJ
120%15%20%10%
2CP DATEVESSELSQMAREAAMOUNTSALES REPKEVINJOHNROBERTBILL
325/2/2022PENTHOUSE355CENTRE$ 29,673.00KEVIN$ 5,934.60$ -$ -$ -
426/2/2022LOFT230SOUTH$ 28,032.00JOHN$ -$ 4,204.80$ -$ -
527/2/2022MANSION147NORTH$ 44,865.00BILL$ -$ -$ -$ 4,486.50
628/2/2022LOFT194NORTH$ 48,492.00KEVIN & JOHN$ -$ -$ -$ -
71/3/2022MANSION88SOUTH$ 41,831.00BILL &KEVIN$ -$ -$ -$ -
82/3/2022HOUSE78CENTRE$ 59,924.00ROBERT$ -$ -$ 11,984.80$ -
93/3/2022MANSION84CENTRE$ 64,867.00BILL & JOHN & ROBERT$ -$ -$ -$ -
104/3/2022PENTHOUSE177SOUTH$ 72,451.00ROBERT & KEVIN$ -$ -$ -$ -
115/3/2022LOFT113NORTH$ 39,103.00KEVIN & JOHN$ -$ -$ -$ -
126/3/2022LOFT347SOUTH$ 45,335.00KEVIN$ 9,067.00$ -$ -$ -
137/3/2022MANSION173CENTRE$ 47,890.00BILL &KEVIN$ -$ -$ -$ -
148/3/2022HOUSE163SOUTH$ 78,916.00ROBERT & KEVIN$ -$ -$ -$ -
159/3/2022HOUSE100NORTH$ 36,550.00ROBERT & KEVIN$ -$ -$ -$ -
1610/3/2022PENTHOUSE51WEST$ 60,594.00JOHN & BILL$ -$ -$ -$ -
1711/3/2022LOFT375WEST$ 28,861.00BILL & KEVIN$ -$ -$ -$ -
1812/3/2022LOFT279NORTH$ 74,130.00KEVIN & JOHN$ -$ -$ -$ -
1913/3/2022MANSION330EAST$ 58,979.00BILL &KEVIN$ -$ -$ -$ -
2014/3/2022PENTHOUSE84SOUTH$ 72,012.00JOHN$ -$ 10,801.80$ -$ -
2115/3/2022LOFT164EAST$ 18,166.00ROBERT & BILL$ -$ -$ -$ -
2215/12/2022HOUSE212WEST$ 46,311.00ROBERT & JOHN & BILL$ -$ -$ -$ -
Sheet1
Cell Formulas
RangeFormula
G3:G22G3=IF([@[SALES REP]]=Table1[[#Headers],[KEVIN]],[@AMOUNT]*$G$1,0)
H3:H22H3=IF([@[SALES REP]]=Table1[[#Headers],[JOHN]],[@AMOUNT]*$H$1,0)
I3:I22I3=IF([@[SALES REP]]=Table1[[#Headers],[ROBERT]],[@AMOUNT]*$I$1,0)
J3:J22J3=IF([@[SALES REP]]=Table1[[#Headers],[BILL]],[@AMOUNT]*$J$1,0)


This formula only works when the sales is done individually.
I want a formula that calculates the commission for each salesrep if the sale is done individually according to his percentage
But if it is done in collaboration with another salesrep split the commission between them at 15% each
How do i combine this 2 criteria together and inside a table not normal range.

Thank u in advance.
 
Temp.xlsx
ABCDEFGHIJ
120%15%20%10%
2CP DATEVESSELSQMAREAAMOUNTSALES REPKEVINJOHNROBERTBILL
325/02/2022PENTHOUSE355CENTRE$29,673.00KEVIN$ 5,934.60$ -$ -$ -
426/02/2022LOFT230SOUTH$28,032.00JOHN$ -$ 4,204.80$ -$ -
527/02/2022MANSION147NORTH$44,865.00BILL$ -$ -$ -$4,486.50
628/02/2022LOFT194NORTH$48,492.00KEVIN & JOHN$ 7,273.80$ 7,273.80$ -$ -
701/03/2022MANSION88SOUTH$41,831.00BILL &KEVIN$ 6,274.65$ -$ -$4,183.10
802/03/2022HOUSE78CENTRE$59,924.00ROBERT$ -$ -$11,984.80$ -
903/03/2022MANSION84CENTRE$64,867.00BILL & JOHN & ROBERT$ -$ 9,730.05$ 9,730.05$6,486.70
1004/03/2022PENTHOUSE177SOUTH$72,451.00ROBERT & KEVIN$10,867.65$ -$10,867.65$ -
1105/03/2022LOFT113NORTH$39,103.00KEVIN & JOHN$ 5,865.45$ 5,865.45$ -$ -
1206/03/2022LOFT347SOUTH$45,335.00KEVIN$ 9,067.00$ -$ -$ -
1307/03/2022MANSION173CENTRE$47,890.00BILL &KEVIN$ 7,183.50$ -$ -$4,789.00
1408/03/2022HOUSE163SOUTH$78,916.00ROBERT & KEVIN$11,837.40$ -$11,837.40$ -
1509/03/2022HOUSE100NORTH$36,550.00ROBERT & KEVIN$ 5,482.50$ -$ 5,482.50$ -
1610/03/2022PENTHOUSE51WEST$60,594.00JOHN & BILL$ -$ 9,089.10$ -$6,059.40
1711/03/2022LOFT375WEST$28,861.00BILL & KEVIN$ 4,329.15$ -$ -$2,886.10
1812/03/2022LOFT279NORTH$74,130.00KEVIN & JOHN$11,119.50$11,119.50$ -$ -
1913/03/2022MANSION330EAST$58,979.00BILL &KEVIN$ 8,846.85$ -$ -$5,897.90
2014/03/2022PENTHOUSE84SOUTH$72,012.00JOHN$ -$10,801.80$ -$ -
2115/03/2022LOFT164EAST$18,166.00ROBERT & BILL$ -$ -$ 2,724.90$1,816.60
2215/12/2022HOUSE212WEST$46,311.00ROBERT & JOHN & BILL$ -$ 6,946.65$ 6,946.65$4,631.10
Sheet1
Cell Formulas
RangeFormula
G3:J22G3=IF(ISNUMBER(SEARCH(G$2,$F3)),IF(AND(COUNTA(TEXTSPLIT($F3,"&"))>1,G$2<>"BILL"),$E3*15%,IF(AND(COUNTA(TEXTSPLIT($F3,"&"))>1,G$2="BILL"),$E3*$J$1,IF(COUNTA(TEXTSPLIT($F3,"&"))=1,$E3*G$1,0))),0)
What am i doing wrong?
DEMO FOR VBA1.xlsx
ABCDEFGHIJ
120%15%20%10%
2CP DATEVESSELSQMAREAAMOUNTSALES REPKEVINJOHNROBERTBILL
325/2/2022PENTHOUSE355CENTRE$ 29,673.00KEVIN$ 5,934.60$ -$ -$ -
426/2/2022LOFT230SOUTH$ 28,032.00JOHN$ -$ 4,204.80$ -$ -
527/2/2022MANSION147NORTH$ 44,865.00BILL$ -$ -$ -$ 4,486.50
628/2/2022LOFT194NORTH$ 48,492.00KEVIN & JOHN$ 9,698.40$ 7,273.80$ -$ -
71/3/2022MANSION88SOUTH$ 41,831.00BILL &KEVIN$ 8,366.20$ -$ -$ 4,183.10
82/3/2022HOUSE78CENTRE$ 59,924.00ROBERT$ -$ -$ 11,984.80$ -
93/3/2022MANSION84CENTRE$ 64,867.00BILL & JOHN & ROBERT$ -$ 9,730.05$ 12,973.40$ 6,486.70
104/3/2022PENTHOUSE177SOUTH$ 72,451.00ROBERT & KEVIN$ 14,490.20$ -$ 14,490.20$ -
115/3/2022LOFT113NORTH$ 39,103.00KEVIN & JOHN$ 7,820.60$ 5,865.45$ -$ -
126/3/2022LOFT347SOUTH$ 45,335.00KEVIN$ 9,067.00$ -$ -$ -
137/3/2022MANSION173CENTRE$ 47,890.00BILL &KEVIN$ 9,578.00$ -$ -$ 4,789.00
148/3/2022HOUSE163SOUTH$ 78,916.00ROBERT & KEVIN$ 15,783.20$ -$ 15,783.20$ -
159/3/2022HOUSE100NORTH$ 36,550.00ROBERT & KEVIN$ 7,310.00$ -$ 7,310.00$ -
1610/3/2022PENTHOUSE51WEST$ 60,594.00JOHN & BILL$ -$ 9,089.10$ -$ 6,059.40
1711/3/2022LOFT375WEST$ 28,861.00BILL & KEVIN$ 5,772.20$ -$ -$ 2,886.10
1812/3/2022LOFT279NORTH$ 74,130.00KEVIN & JOHN$ 14,826.00$ 11,119.50$ -$ -
1913/3/2022MANSION330EAST$ 58,979.00BILL &KEVIN$ 11,795.80$ -$ -$ 5,897.90
2014/3/2022PENTHOUSE84SOUTH$ 72,012.00JOHN$ -$ 10,801.80$ -$ -
2115/3/2022LOFT164EAST$ 18,166.00ROBERT & BILL$ -$ -$ 3,633.20$ 1,816.60
2215/12/2022HOUSE212WEST$ 46,311.00ROBERT & JOHN & BILL$ -$ 6,946.65$ 9,262.20$ 4,631.10
Sheet1
Cell Formulas
RangeFormula
G3:J22G3=IF(ISNUMBER(SEARCH(G$2,$F3)),IF(AND(COUNTA(TEXTSPLIT($F3,"&"))>1,G$2<>"BILL"),$E3*15%,IF(AND(COUNTA(TEXTSPLIT($F3,"&"))>1,G$2="BILL"),$E3*$J$1,IF(COUNTA(TEXTSPLIT($F3,"&"))=1,$E3*G$1,0))),0)
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Can you check whether you have TextSplit function installed.

Since the file works fine in my laptop even when I copy your data
 
Upvote 0
Can you check whether you have TextSplit function installed.

Since the file works fine in my laptop even when I copy your data
You are right it is not installed i have office 2019
Is there anyway i can install it?
I think it is only available for office 365
 
Upvote 0
i have office 2019
First thing to clarify is exactly what version you do have. You keep stating that you have 2019 but your profile still says 365, 2021 and 2019.

Go to File -> Account and have a look in this area near the top where mine shows that I am using 365.

1675120013414.png


If yours is 2019 then please remove 365 and 2021 from your account details. It is unfair to have helpers waste their time developing suggestions for you if you have given misleading information about your version & therefore about what resources you have available.

If you do only have 2019 then try the formulas below.
If it turns out you have a later version then perhaps a shorter formula could be possible.

BTW, my formulas depend on your data being uniform, which your sample data is not. In most cases you have a space each side of the "&" when multiple sales reps are listed. However in some cells you have "BILL & KEVIN" and in others you have "BILL &KEVIN". My formula assumes a space on each side of the "&".

greekexcel.xlsm
EFGHIJ
10.20.150.20.1
2AMOUNTSALES REPKEVINJOHNROBERTBILL
3$ 29,673.00KEVIN$ 5,934.60$ -$ -$ -
4$ 28,032.00JOHN$ -$ 4,204.80$ -$ -
5$ 44,865.00BILL$ -$ -$ -$ 4,486.50
6$ 48,492.00KEVIN & JOHN$ 7,273.80$ 7,273.80$ -$ -
7$ 41,831.00BILL & KEVIN$ 6,274.65$ -$ -$ 6,274.65
8$ 59,924.00ROBERT$ -$ -$ 11,984.80$ -
9$ 64,867.00BILL & JOHN & ROBERT$ -$ 6,486.70$ 6,486.70$ 6,486.70
10$ 72,451.00ROBERT & KEVIN$ 10,867.65$ -$ 10,867.65$ -
11$ 39,103.00KEVIN & JOHN$ 5,865.45$ 5,865.45$ -$ -
12$ 45,335.00KEVIN$ 9,067.00$ -$ -$ -
13$ 47,890.00BILL & KEVIN$ 7,183.50$ -$ -$ 7,183.50
14$ 78,916.00ROBERT & KEVIN$ 11,837.40$ -$ 11,837.40$ -
15$ 36,550.00ROBERT & KEVIN$ 5,482.50$ -$ 5,482.50$ -
16$ 60,594.00JOHN & BILL$ -$ 9,089.10$ -$ 9,089.10
17$ 28,861.00BILL & KEVIN$ 4,329.15$ -$ -$ 4,329.15
18$ 74,130.00KEVIN & JOHN$ 11,119.50$ 11,119.50$ -$ -
19$ 58,979.00BILL & KEVIN$ 8,846.85$ -$ -$ 8,846.85
20$ 72,012.00JOHN$ -$ 10,801.80$ -$ -
21$ 18,166.00ROBERT & BILL$ -$ -$ 2,724.90$ 2,724.90
22$ 46,311.00ROBERT & JOHN & BILL$ -$ 4,631.10$ 4,631.10$ 4,631.10
23
24
Sheet1
Cell Formulas
RangeFormula
G3:J22G3=IF(ISNUMBER(SEARCH(" "&G$2&" "," "&$F3&" ")),IF(LEN($F3)-LEN(SUBSTITUTE($F3,"&",""))+1=1,$E3*G$1,$E3*0.3/(LEN($F3)-LEN(SUBSTITUTE($F3,"&",""))+1)),0)
 
Upvote 0
First thing to clarify is exactly what version you do have. You keep stating that you have 2019 but your profile still says 365, 2021 and 2019.

Go to File -> Account and have a look in this area near the top where mine shows that I am using 365.

View attachment 84193

If yours is 2019 then please remove 365 and 2021 from your account details. It is unfair to have helpers waste their time developing suggestions for you if you have given misleading information about your version & therefore about what resources you have available.

If you do only have 2019 then try the formulas below.
If it turns out you have a later version then perhaps a shorter formula could be possible.

BTW, my formulas depend on your data being uniform, which your sample data is not. In most cases you have a space each side of the "&" when multiple sales reps are listed. However in some cells you have "BILL & KEVIN" and in others you have "BILL &KEVIN". My formula assumes a space on each side of the "&".

greekexcel.xlsm
EFGHIJ
10.20.150.20.1
2AMOUNTSALES REPKEVINJOHNROBERTBILL
3$ 29,673.00KEVIN$ 5,934.60$ -$ -$ -
4$ 28,032.00JOHN$ -$ 4,204.80$ -$ -
5$ 44,865.00BILL$ -$ -$ -$ 4,486.50
6$ 48,492.00KEVIN & JOHN$ 7,273.80$ 7,273.80$ -$ -
7$ 41,831.00BILL & KEVIN$ 6,274.65$ -$ -$ 6,274.65
8$ 59,924.00ROBERT$ -$ -$ 11,984.80$ -
9$ 64,867.00BILL & JOHN & ROBERT$ -$ 6,486.70$ 6,486.70$ 6,486.70
10$ 72,451.00ROBERT & KEVIN$ 10,867.65$ -$ 10,867.65$ -
11$ 39,103.00KEVIN & JOHN$ 5,865.45$ 5,865.45$ -$ -
12$ 45,335.00KEVIN$ 9,067.00$ -$ -$ -
13$ 47,890.00BILL & KEVIN$ 7,183.50$ -$ -$ 7,183.50
14$ 78,916.00ROBERT & KEVIN$ 11,837.40$ -$ 11,837.40$ -
15$ 36,550.00ROBERT & KEVIN$ 5,482.50$ -$ 5,482.50$ -
16$ 60,594.00JOHN & BILL$ -$ 9,089.10$ -$ 9,089.10
17$ 28,861.00BILL & KEVIN$ 4,329.15$ -$ -$ 4,329.15
18$ 74,130.00KEVIN & JOHN$ 11,119.50$ 11,119.50$ -$ -
19$ 58,979.00BILL & KEVIN$ 8,846.85$ -$ -$ 8,846.85
20$ 72,012.00JOHN$ -$ 10,801.80$ -$ -
21$ 18,166.00ROBERT & BILL$ -$ -$ 2,724.90$ 2,724.90
22$ 46,311.00ROBERT & JOHN & BILL$ -$ 4,631.10$ 4,631.10$ 4,631.10
23
24
Sheet1
Cell Formulas
RangeFormula
G3:J22G3=IF(ISNUMBER(SEARCH(" "&G$2&" "," "&$F3&" ")),IF(LEN($F3)-LEN(SUBSTITUTE($F3,"&",""))+1=1,$E3*G$1,$E3*0.3/(LEN($F3)-LEN(SUBSTITUTE($F3,"&",""))+1)),0)
Peter i very much appreciate for taking the time and helping me.
If yours is 2019 then please remove 365 and 2021 from your account details. It is unfair to have helpers waste their time developing suggestions for you if you have given misleading information about your version & therefore about what resources you have available.
You are right about this i have office 2019 installed on my pc and i can access excel through my company's outlook account (but it is not a paid subscription for excel).I will update my account immediately
BTW, my formulas depend on your data being uniform, which your sample data is not. In most cases you have a space each side of the "&" when multiple sales reps are listed. However in some cells you have "BILL & KEVIN" and in others you have "BILL &KEVIN". My formula assumes a space on each side of the "&".
I am aware of the "&" issue i fixed it .
Your formula works perfectly thank you!!
I have one last question is there any chance to make an exception for "BILL" that he will still get 10% even if
the sale is done in collaboration with another salesrep?

Thank you very much you have been really helpful!!
 
Upvote 0
Your formula works perfectly thank you!!
Good news. Thanks for the confirmation.

is there any chance to make an exception for "BILL" that he will still get 10% even if
the sale is done in collaboration with another salesrep?
How much will the other person get if Bill only gets 10%?
In particular, if sharing with John, how much would John get given his normal rate is 15%? All the other sharing was sharing a total of 30% but it would not seem right to me if he got a higher percentage (20%) by sharing than he would if alone.

This will probably be doable but the formula may get considerably more complex.

I will update my account immediately
o_O
 
Upvote 0
Good news. Thanks for the confirmation.


How much will the other person get if Bill only gets 10%?
In particular, if sharing with John, how much would John get given his normal rate is 15%? All the other sharing was sharing a total of 30% but it would not seem right to me if he got a higher percentage (20%) by sharing than he would if alone.

This will probably be doable but the formula may get considerably more complex.
How much will the other person get if Bill only gets 10%?
15%
In particular, if sharing with John, how much would John get given his normal rate is 15%? All the other sharing was sharing a total of 30% but it would not seem right to me if he got a higher percentage (20%) by sharing than he would if alone.
John will still get 15%.
In Collaborations between salesrepresentatives each of them gets 15% commission.
The only exemption is "BILL" whoever makes a collaboration with "Bill" i want "Bill" to earn 10% and the other rep 15%.

Sanjeev1976 wrote a formula that can calculate this variable for "BILL" but unfortunately only works in office 365(i tested it).

If there is a way to find a solution for this one i owe you big time once again 🤣
 
Upvote 0
If there is a way to find a solution for this one
There should be, but I didn't ask enough questions.
  1. What if Bill, John and Kevin collaborate? What does each get?
  2. What if Bill, Kevin & Robert collaborate? What does each get?
  3. What if Kevin, John, Robert & Bill all collaborate (if that is possible)? What does each get?
 
Upvote 0
  1. What if Bill, John and Kevin collaborate? What does each get?
10% each
The collaboration commission percentage is 30% always.
In most of the cases they are 2 salesrep each getting 15%
In some cases they are 3 salesrep they split 30% equally 10% each (your formula works in this case i have tested it) :D
I only want "Bill" to get 10% always both individually and collaborating and the other salesrep that is collaborating with him will get 15%
  1. What if Bill, Kevin & Robert collaborate? What does each get?
Same as above!
  1. What if Kevin, John, Robert & Bill all collaborate (if that is possible)? What does each get?
It is not possible but thank u for asking!
 
Upvote 0
The collaboration commission percentage is 30% always.
It isn't according to your answers to the questions below where you said Bill gets 10% and the other person gets 15%. That is 25%, not 30%.
How much will the other person get if Bill only gets 10%?
In particular, if sharing with John, how much would John get given his normal rate is 15%?
John will still get 15%.
 
Upvote 0

Forum statistics

Threads
1,215,135
Messages
6,123,241
Members
449,093
Latest member
Vincent Khandagale

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