Remainder to be Subtracted from the next Instance Found

DragonJad

New Member
Joined
Apr 28, 2010
Messages
37
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi All,

I'm having difficulties figuring out what function to use in the OUT column (B) to calculate the following:

If the number in OUT (G) is greater than the TOTAL C then it should only show the MAX of TOTAL (C) otherwise subtract the remainder from the next instance of the colour (A)
Blue is 5 TOTAL - therefore the first instance of Blue is 3 and the next should be 2, not 3 each.

1658132076395.png


Would this be a nested IF with MOD? Any advice would be appreciated! Thank you
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Like this?

ABCDEFG
1ColourOutTotalColourOut
2Yellow22Yellow7
3Green11Green2
4Yellow516Blue5
5Blue33
6Blue23
7Yellow05
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=MIN(C2,VLOOKUP(A2,F$2:G$4,2,)-SUMIF(A$1:A1,A2,B$1:B1))
 
Upvote 0
Solution
You Sir, receive 100 respect points for this!
I was so very wrong with all the functions I thought it could be! Thank you very much :)
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

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