Proportionally splitting a value between cells based on values and conditions

Midavalo

New Member
Joined
Apr 23, 2007
Messages
7
Office Version
  1. 365
Platform
  1. Windows
In my data I have a couple of columns that are added to regularly (Val1 and Val2) from which I need to subtract a total (Calc) into two new columns (Net_Val1 and Net_Val2). I need to subtract my value in Calc proportionately between Val1 and Val2, however there are some conditions that need to be met. I'm calculating the value to subtract into Val1_C and Val2_C.
  1. If Val2 is 0 (or less than 0) the full amount is subtracted from Val1 (see rows 2-4)
  2. I can only reduce Val2 by a half maximum. Anything remaining is subtracted from Val1 (see rows 5, 7, 8)
  3. Because of #2 above, Val2 can never be reduced to negative. Val1 can be negative.
  4. If both Val1 and Val2 are positive, and none of the above apply, then proportion the value in Calc between Val1 and Val2, eg
    Excel Formula:
    =[@Calc]/SUM([@[Val1]:[Val2]])*[@Val1]
    (see rows 6, 9)
So I can get #1 and #4 into an IFS() formula OK (I think), but I'm having a hard time incorporating #2...
Excel Formula:
=IFS([@Val2]<=0,[@Calc],TRUE,[@Calc]/SUM([@[Val1]:[Val2]])*[@Val1])
although this also falls over a bit if Val1 is a negative.

I'd appreciate a point in the right direction please. Here is my sample data, with what I expect to see in Val1_C and Val2_C. I've struggled to put this all into words, so hopefully it makes sense enough.

MyCalcTesting.xlsx
ABCDEFG
1Val1Val2Val1_CVal2_CCalcNet_Val1Net_Val2
2475010001000-5250
314500100010004500
4-2450010001000-34500
5-15006007003001000-2200300
63950210949.5250.4810003000.48159.52
7-100100900501000-100050
822511204405601000-215560
9375405084.75915.251000290.253134.75
Sheet2
Cell Formulas
RangeFormula
E2:E9E2=1000
F2:F9F2=[@Val1]-[@[Val1_C]]
G2:G9G2=[@Val2]-[@[Val2_C]]
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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