Grouping Logic Baed on Qty

jarett

Board Regular
Joined
Apr 12, 2021
Messages
165
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have posted this in another forum and have not received an answer so trying in here.
Grouping Logic Based on Qty

I have a set a data that is sorted to have a C- item code to be the first line of the PurchaseOrder# then all the items that go with the C- item right below it. I need to figure out how I can make the C- item line and the items that go with it have a "group 1 number", this would be another column/field. Any items not falling under this would be "group 2". In the example attached "PurchaseOrder"=0002151 would only have 1 group because the C- item is a qty of 1 and there is only 1 item below it. On "PurchaseOrderNo"=0002172 would have 2 groups, C-ACTLIN01 and the 24 items below it would be group 2 and the 3 lines above the C-ACTLIN01 would be group 1. Any ideas on best way to do this?
 

Attachments

  • ex.png
    ex.png
    61.5 KB · Views: 18

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I'm still a little hazy on the requirements, but try:

Book1
BCDE
1PurchaseOrderQuantityItemCodeGroupNo
22140P-INDM10Group 1
32141xGroup 1
42144C-ACTTAL03 
52144yGroup 1
62151C-ACTDAN03 
72151zGroup 1
82153C-ACTDAN04 
92153aGroup 1
102157C-ACTDAN02 
112157bGroup 1
122157C-ACTDAN04 
132157cGroup 2
142172dGroup 1
152172eGroup 1
162172fGroup 1
172172C-ACTLIN01 
182172gGroup 2
192172hGroup 2
202172iGroup 2
212172jGroup 2
222172kGroup 2
232172lGroup 2
242172mGroup 2
252172nGroup 2
262172oGroup 2
272172pGroup 2
282172qGroup 2
Sheet14
Cell Formulas
RangeFormula
E2:E28E2=IF(LEFT(D2,2)="C-","",IF(COUNTIFS(B$2:B2,B2,D$2:D2,"C-*")=0,"Group 1",IF(COUNTIFS(B$1:B1,B2,E$1:E1,"Group 1")=0,"Group 1","Group 2")))
 
Upvote 0
I'm still a little hazy on the requirements, but try:

Book1
BCDE
1PurchaseOrderQuantityItemCodeGroupNo
22140P-INDM10Group 1
32141xGroup 1
42144C-ACTTAL03 
52144yGroup 1
62151C-ACTDAN03 
72151zGroup 1
82153C-ACTDAN04 
92153aGroup 1
102157C-ACTDAN02 
112157bGroup 1
122157C-ACTDAN04 
132157cGroup 2
142172dGroup 1
152172eGroup 1
162172fGroup 1
172172C-ACTLIN01 
182172gGroup 2
192172hGroup 2
202172iGroup 2
212172jGroup 2
222172kGroup 2
232172lGroup 2
242172mGroup 2
252172nGroup 2
262172oGroup 2
272172pGroup 2
282172qGroup 2
Sheet14
Cell Formulas
RangeFormula
E2:E28E2=IF(LEFT(D2,2)="C-","",IF(COUNTIFS(B$2:B2,B2,D$2:D2,"C-*")=0,"Group 1",IF(COUNTIFS(B$1:B1,B2,E$1:E1,"Group 1")=0,"Group 1","Group 2")))
I’ll try this in access tomorrow when I get into the office but looking at it on my phone is this in excel?
 
Upvote 0
I think Eric may have missed that this was posted in the Access forum, and posted an Excel solution.
 
Upvote 0

Forum statistics

Threads
1,215,766
Messages
6,126,760
Members
449,336
Latest member
p17tootie

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