Count unique order splits

CaptainGravyBum

Board Regular
Joined
Dec 1, 2023
Messages
98
Office Version
  1. 365
Platform
  1. Windows
Hello,
Please can you help, I have the sheet below where the count (column C) can only be a maximum of 80 items, at which point the remainder ends up in the splits column (column D). I need column E to show if the split count for the total order rows is 80 items combined then it shows 80 on one row per order and the remainder follows afterwards.
so, to try and make it clearer, when the same order number has 80 items it counts as 80 on the row where the total is reached and starts counting again on subsequent rows.
I've put in example data to show how it should look. Sorry for the table, xl2bb wouldn't paste the information.


Order IDWay of deliveryCountSplit down unitsCombined number or surplus
125838Van1002020
121994Van80
121994Van10020
121994Van10020
121994Van10020
121994Van1002080
121994Van1002020
123151Customer collection 90
123151Customer collection 450
 
Try this formula in D2:
Excel Formula:
=MAX(0,C2-80)
And this formula in E2:
Excel Formula:
=IF(A2<>A3,SUMIFS(D$1:D2,A$1:A2,A2)-SUMIFS(E$1:E1,A$1:A1,A2),FLOOR(SUMIFS(D$1:D2,A$1:A2,A2),80)-SUMIFS(E$1:E1,A$1:A1,A2))
Then fill them down your sheet. See if that does what you're after
 
Upvote 0
Solution
What happened?
Did it give an error?
Did it paste incorrect values?
Something else?

Try to describe in as much details as you can what you did and what happened.
It just wouldn't paste, copied ok, but the ctrl-v or right click paste didn't do anything. Probably my end tbf
 
Upvote 0
I have had success today with the xl2bb, see below with the suggested formulas. I have an additional query, on the combined total column, it counts up to 80 units and puts the surplus on the next line.
Is there a way to make it the same when it is 80 exactly, so E7 for example should show zero because it is a total of 80.

Book2.xlsx
ABCDE
1Order IDWay of deliveryCountSplit down unitsCombined number or surplus
2125838Van1002020
3121994Van800
4121994Van100200
5121994Van100200
6121994Van100200
7121994Van1002080
8121994Van1002020
9123151Customer collection 900
10123151Customer collection 4500
Sheet1
Cell Formulas
RangeFormula
D2:D10D2=IF(AND(B2="Van",C2>80),C2-80,0)
E2:E10E2=IF(A2<>A3,SUMIFS(D$1:D2,A$1:A2,A2)-SUMIFS(E$1:E1,A$1:A1,A2),FLOOR(SUMIFS(D$1:D2,A$1:A2,A2),80)-SUMIFS(E$1:E1,A$1:A1,A2))
 
Upvote 0

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