Hi ram-estimating,
I combine both excel to sample tab, working tab and formula tab(result).
First, it have two helper column in the working tab, in the front of data (column A, due to limitation of vlookup), and the last column (column I)
in A2, key in below formula and paste to last row+1, (ie. if have 10 row of data, copy to 11th row)
Formula:
=IF(ISNUMBER(A1),IF(ISBLANK(B2),A1+I1-1,A1+I1),1)
This is to determine the first row of each "CRRT" and the last row of "CRRT" needed.
in I2, key in below formula and paste to last row
Formula:
=IF(MOD(F2,250)<=50,ROUNDDOWN(F2/250,0),ROUNDUP(F2/250,0))
This is to find how many bandle need for each "CRRT"
Mod is find the remain amount after divide (ie, Mod(5,2) the result is 1)
helper column done, now the result part
in formula tab, have to add in one column in front.(column A)
in A2 to last row put down the series number (ie, 1,2,3,4,5....) till the last number in the Working tab column A (ie, this workbook is A22, value is 21)
in D2, key in below formula and paste to last row
Formula:
=VLOOKUP(A2,Working!$A$2:$C$7,3,1)
The false vlookup perform the repeat of "CRRT"
in C2, key in below formula and paste to last row
Formula:
=INDEX(Working!$B$2:$B$7,MATCH(Formula!D2,Working!$C$2:$C$7,0))
It find the Zip value in working tab based on column D
in E2, key in below formulaand paste to last row
Formula:
=IF((INDEX(Working!$F$2:$F$7,MATCH(D2,Working!$C$2:$C$7,0))-SUMIF(D$1:D1,D2,E$1:E1))>300,250,INDEX(Working!$F$2:$F$7,MATCH(D2,Working!$C$2:$C$7,0))-SUMIF(D$1:D1,D2,E$1:E1))
it check whether the remain value is exceed 300, if yes, 250, if not will show remain that less than 300.
in F2, key in below formula and paste to last row
Formula:
=COUNTIF(D$2:D2,D2)
It count the occurrence of "CRRT" from top to end
in G2, key in below Array formula and paste to last row
Formula:
=MAX(IF($D$2:$D$22=D2,$F$2:$F$22))
It find the max value in column F, by same "CRRT"
PS: array formula is need to confirm by Ctrl + Shift + Enter
If not understand, please follow below step:
1, Paste the formula to the cell
2, Double click on the cell
3, press Ctrl + Shift + Enter
It show { sign in front of formula. (ie "{=ind.....)
Bookmarks