Excel Formula to Adjust Difference equally amoung rest

Jalal Kasmani

Board Regular
Joined
Feb 14, 2015
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Hi Formula Champions,

Book1.xlsx
EFGHIJKLMN
122%38%20%20%
2RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0
310022Yes0No22Yes22Yes-34
41000No0No22Yes22Yes-56
Sheet1
Cell Formulas
RangeFormula
L3:L4,J3:J4,H3,F3:F4F3=IF(G3="No",0,$E$3*$F$1)
H4H4=IF(I4="No",0,$E$3*H2)
N3:N4N3=(F3+H3+J3+L3)-E3



I want to adjust the difference of column N equally amoung rest Employees wherever it is yes. Please help i tried multiple things still no luck , its giving cell reference error.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Below is the correct thread and the desired output in cell J11 and L11.

Book1.xlsx
EFGHIJKLMN
122%38%20%20%
2RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0
310022Yes0No20Yes20Yes-38
41000No0No20Yes20Yes-60
5
6Desired Output
7
822%38%20%20%
9RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0
1010022Yes0No20Yes20Yes-38
111000No0No50Yes50Yes0
Sheet1
Cell Formulas
RangeFormula
H11,F10:F11,L4,J4,H4,F3:F4F3=IF(G3="No",0,$E3*F$1)
H3,L10,J10,H10,L3,J3H3=IF(I3="No",0,$E$3*H$1)
N10:N11,N3:N4N3=(F3+H3+J3+L3)-E3
J11J11=IF(K11="No",0,$E11*J$1) + 30
L11L11=IF(M11="No",0,$E11*L$1) +30
 
Upvote 0
Hi,

Does this do what you need:

Book3.xlsx
EFGHIJKLMN
122%38%20%20%
2RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0
310033.33Yes0No33.33Yes33.33Yes0
41000No0No50Yes50Yes0
Sheet1033
Cell Formulas
RangeFormula
L3:L4,J3:J4,H3:H4,F3:F4F3=IF(G3="No",0,IF(SUM($G3="Yes",$I3="Yes",$K3="Yes",$M3="Yes")=4,$E3*F$1,$E3/SUM($G3="Yes",$I3="Yes",$K3="Yes",$M3="Yes")))
N3:N4N3=(F3+H3+J3+L3)-E3
 
Upvote 0
You are almost close to the solution, your solution ignores the % in row number 1. It has to first allocate basis the % in row number 1 and than whatever is left in column N that should get divided.

For ex:- when you go to my example in row number 11(ignore row 10). I have first allocated on the basis of % there in row 1, and than whatever is left ie 60 . i have manually entered 30 each (60 divided by 2 as there are 2 Yes), - infact this should come with a formula. I get circular reference error when I do that with a formula.

I have one other idea as well, instead of applying formula in col N to get the difference and than dividing equally(which gives circular ref error). We can rather keep adding amount using row number 1 percentage wherever It's No, and than divide that amount equally amoung the people wherever it's Yes. Thumb rule is to first consider the % in row 1 and than add.
 
Upvote 0
You can edit the formulas if you want negative numbers

T202203a.xlsm
EFGHIJKLMNO
10.220.380.20.2
2RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0
31000No0No50Yes50Yes00.4
4
1c
Cell Formulas
RangeFormula
F3F3=(G3="yes")*F1/O3*E3
H3H3=(I3="yes")*H1/O3*E3
J3J3=(K3="yes")*J1/O3*E3
L3L3=(M3="yes")*L1/O3*E3
N3N3=E3-SUM(F3:M3)
O3O3=((G3="yes")*$F$1+(I3="yes")*$H$1+(K3="yes")*$J$1+(M3="yes")*$L$1)
 
Upvote 0
or you consider either of the following

T202203a.xlsm
EFGHIJK
7RW Total Emp AEmp BEmp CEmp DDiff - Should net to 0
80.220.380.20.2
9NoNoYesYes
1010000505000.4
111500075750
1c
Cell Formulas
RangeFormula
F10:I10F10=(F$9="yes")*F$8/$K$10*$E$10
J10:J11J10=E10-SUM(F10:I10)
K10K10=SUMPRODUCT(--($F$9:$I$9="yes"),$F$8:$I$8)
F11:I11F11=(F$9="yes")*F$8/SUMPRODUCT(--($F$9:$I$9="yes"),$F$8:$I$8)*$E$11
 
Last edited:
Upvote 0
You are almost close to the solution, your solution ignores the % in row number 1. It has to first allocate basis the % in row number 1 and than whatever is left in column N that should get divided.

For ex:- when you go to my example in row number 11(ignore row 10). I have first allocated on the basis of % there in row 1, and than whatever is left ie 60 . i have manually entered 30 each (60 divided by 2 as there are 2 Yes), - infact this should come with a formula. I get circular reference error when I do that with a formula.

I have one other idea as well, instead of applying formula in col N to get the difference and than dividing equally(which gives circular ref error). We can rather keep adding amount using row number 1 percentage wherever It's No, and than divide that amount equally amoung the people wherever it's Yes. Thumb rule is to first consider the % in row 1 and than add.

My formula First test the % allocations, whatever is left, gets Equally divided amongst the Yes Emp.
If it doesn't work as intended, please post sample where it doesn't.
 
Last edited:
Upvote 0
Hi,

Below your formula and what i require in simple 2 steps, your formula does the partial trick and gives the difference as 0. But not sure how the difference amount is adjusted.

Book1.xlsx
CDEFGHIJKLMNO
10.220.380.180.22
2RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0Check
3Allocation with your formula15541.59Yes71.83Yes-No41.59Yes00.82
47.49Please justify the logic why the allocation + 7.4912.93Please justify the logic why the allocation + 12.937.49Please justify the logic why the allocation + 7.4927.90
5Allocation below with my logic with 2 steps
6Step 1Simple Allocation15534.1058.934.127.90
7Step 2Final allocation with diff adjusted equally 43.4068.2043.40-
8
99.30
Sheet2
Cell Formulas
RangeFormula
J3J3=(K3="yes")*J1/O3*E3
O3O3=((G3="yes")*$F$1+(I3="yes")*$H$1+(K3="yes")*$J$1+(M3="yes")*$L$1)
F3F3=(G3="yes")*F1/O3*E3
F4,L4,H4F4=F3-F6
H3H3=(I3="yes")*H1/O3*E3
L3L3=(M3="yes")*L1/O3*E3
N3N3=E3-SUM(F3:M3)
N4N4=SUM(F4:L4)
O6O6=E6-SUM(F6:N6)
F6F6=E3*F1
F7F7=F6+N9
H6H6=E6*H1
H7H7=H6+N9
L6L6=E6*L1
L7L7=L6+N9
N7N7=E6-SUM(F7:M7)
N9N9=O6/3
 
Upvote 0
This should do what you want.

Book3.xlsx
EFGHIJKLMN
122%38%20%20%
2RW Total Emp AEmp A Yes/NoEmp BEmp B Yes/NoEmp CEmp C Yes/NoEmp DEmp D Yes/NoDiff - Should net to 0
310035.48Yes0No32.26Yes32.26Yes0
41000No48.72Yes25.64Yes25.64Yes0
Sheet1033
Cell Formulas
RangeFormula
L3:L4,J3:J4,H3:H4,F3:F4F3=IF(G3="No",0,IF(AND($G3="Yes",$I3="Yes",$K3="Yes",$M3="Yes"),$E3*F$1,F$1/(($G3="Yes")*$F$1+($I3="Yes")*$H$1+($K3="Yes")*$J$1+($M3="Yes")*$L$1)*$E3))
N3:N4N3=(F3+H3+J3+L3)-E3
 
Upvote 0
Solution

Forum statistics

Threads
1,223,981
Messages
6,175,767
Members
452,668
Latest member
mrider123

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