labelling group if condition is met

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,005
Office Version
  1. 365
Platform
  1. Windows
interesting problem. i am working with machine parts. a machine part may come from one or many suppliers. I need to identify which parts have one supplier and which parts have many suppliers. i have my list of parts, and i have the name of each supplier that they have come from. i need a third field that states simply One or Many. i also will have to redo this table for multiple sites with thousands of parts so don't want to do it manually. i am thinking that there might be a solution using countif similar to when looking for duplicates in a long list. however, this will have to look for changes in the One or Many column for each part. ?????????
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
share your sample data using below link XL2BB
 
Upvote 0
my apologies. i have worded my query incorrectly. have been discussing with the boss and i was going about this the wrong way. we have a list of suppliers providing certain parts. some parts are in use, some are not. need to label the supplier either Active, Inactive, or Partially Active based on their supply of parts. the part i am struggling with is the Partially. This applies when a supplier has provided a mix of in use and no longer used parts. table below

so, Supplier, part number, whether we use it or not. The last column is the desired outcome and is where i need to come up with a label. This grid is adapted from a pivot table but can apply a formula to the original data if easier.

SupplierPart Number Part UsedSupplier Activity
Supplier 10000000020200987ActiveActive
Supplier 20000000020188139ActiveActive
0000000020198190Active
Supplier 30000000020184425InactiveInactive
Supplier 40000000020184649ActivePartially Active
0000000020185787Inactive
0000000020187295Active
Supplier 50000000021794878ActiveActive
0000000021810988Active
Supplier 60000000021404803InactivePartially Active
0000000021404810Active
0000000021404817Active
0000000021404864Active
0000000021404871Active
 
Upvote 0
Try with helper column E

IF Practice.xlsx
ABCDEFG
1SupplierPart Number Part UsedSupplier ActivityHelperSupplier Activity
2Supplier 120200987ActiveActiveSupplier 1Active
3Supplier 220188139ActiveActiveSupplier 2Active
420198190ActiveSupplier 2Active
5Supplier 320184425InactiveInactiveSupplier 3Inactive
6Supplier 420184649ActivePartially ActiveSupplier 4Partially Active
720185787InactiveSupplier 4Partially Active
820187295ActiveSupplier 4Partially Active
9Supplier 521794878ActiveActiveSupplier 5Active
1021810988ActiveSupplier 5Active
11Supplier 621404803InactivePartially ActiveSupplier 6Partially Active
1221404810ActiveSupplier 6Partially Active
1321404817ActiveSupplier 6Partially Active
1421404864ActiveSupplier 6Partially Active
1521404871ActiveSupplier 6Partially Active
16
17
Sheet1
Cell Formulas
RangeFormula
E2:E15E2=IF(ISBLANK(A2),E1,A2)
F2:F15F2=IF(COUNTIF(E:E,E2)=1,Q2,IF(AND(COUNTIFS(E:E,E2,C:C,"Active")>0,COUNTIFS(E:E,E2,C:C,"Inactive")=0),Q2,"Partially Active"))
 
Upvote 0
Try with helper column E

IF Practice.xlsx
ABCDEFG
1SupplierPart Number Part UsedSupplier ActivityHelperSupplier Activity
2Supplier 120200987ActiveActiveSupplier 1Active
3Supplier 220188139ActiveActiveSupplier 2Active
420198190ActiveSupplier 2Active
5Supplier 320184425InactiveInactiveSupplier 3Inactive
6Supplier 420184649ActivePartially ActiveSupplier 4Partially Active
720185787InactiveSupplier 4Partially Active
820187295ActiveSupplier 4Partially Active
9Supplier 521794878ActiveActiveSupplier 5Active
1021810988ActiveSupplier 5Active
11Supplier 621404803InactivePartially ActiveSupplier 6Partially Active
1221404810ActiveSupplier 6Partially Active
1321404817ActiveSupplier 6Partially Active
1421404864ActiveSupplier 6Partially Active
1521404871ActiveSupplier 6Partially Active
16
17
Sheet1
Cell Formulas
RangeFormula
E2:E15E2=IF(ISBLANK(A2),E1,A2)
F2:F15F2=IF(COUNTIF(E:E,E2)=1,Q2,IF(AND(COUNTIFS(E:E,E2,C:C,"Active")>0,COUNTIFS(E:E,E2,C:C,"Inactive")=0),Q2,"Partially Active"))
 
Upvote 0
what's in Q2 in your formula at F2? is it just a random blank cell?
 
Upvote 0
final version worked. small changes to your formula but couldn't have got there without your help. Many thanks.

=IF(COUNTIF(H:H,H7)=1,I7,IF(AND(COUNTIFS(H:H,H7,I:I,"Active")>0,COUNTIFS(H:H,H7,I:I,"Inactive")=0),"Active",IF(AND(COUNTIFS(H:H,H7,I:I,"Active")=0,COUNTIFS(H:H,H7,I:I,"Inactive")>0),"Inactive","Partially Active")))
 
Upvote 0
what's in Q2 in your formula at F2? is it just a random blank cell?
I was just trying to build formula and put data in Q column and when I copied data to original location, I forgot to change the reference
below is an updated version
It was just C2 instead Q2

IF Practice.xlsx
ABCDEF
1SupplierPart Number Part UsedSupplier ActivityHelperSupplier Activity
2Supplier 120200987ActiveActiveSupplier 1Active
3Supplier 220188139ActiveActiveSupplier 2Active
420198190ActiveSupplier 2Active
5Supplier 320184425InactiveInactiveSupplier 3Inactive
6Supplier 420184649ActivePartially ActiveSupplier 4Partially Active
720185787InactiveSupplier 4Partially Active
820187295ActiveSupplier 4Partially Active
9Supplier 521794878ActiveActiveSupplier 5Active
1021810988ActiveSupplier 5Active
11Supplier 621404803InactivePartially ActiveSupplier 6Partially Active
1221404810ActiveSupplier 6Partially Active
1321404817ActiveSupplier 6Partially Active
1421404864ActiveSupplier 6Partially Active
1521404871ActiveSupplier 6Partially Active
16
17
Sheet1
Cell Formulas
RangeFormula
E2:E15E2=IF(ISBLANK(A2),E1,A2)
F2:F15F2=IF(COUNTIF(E:E,E2)=1,C2,IF(AND(COUNTIFS(E:E,E2,C:C,"Active")>0,COUNTIFS(E:E,E2,C:C,"Inactive")=0),C2,"Partially Active"))
 
Upvote 0
Hello please see below Results for above formulas and updated formula in column H

IF Practice.xlsx
ABCDEFGHI
1SupplierPart Number Part UsedSupplier ActivityHelperA DurfaniajmUpdate
2Supplier 120200987ActiveActiveSupplier 1ActiveActiveActive
3Supplier 220188139ActiveActiveSupplier 2ActiveActiveActive
420198190ActiveSupplier 2ActivePartially ActiveActive
5Supplier 320184425InactiveInactiveSupplier 3InactiveInactiveInactive
6Supplier 420184649ActivePartially ActiveSupplier 4Partially ActiveActivePartially Active
720185787InactiveSupplier 4Partially ActivePartially ActivePartially Active
820187295ActiveSupplier 4Partially ActivePartially ActivePartially Active
9Supplier 521794878ActiveActiveSupplier 5ActiveActiveActive
1021810988ActiveSupplier 5ActivePartially ActiveActive
11Supplier 621404803InactivePartially ActiveSupplier 6Partially ActiveInactivePartially Active
1221404810ActiveSupplier 6Partially ActivePartially ActivePartially Active
1321404817ActiveSupplier 6Partially ActivePartially ActivePartially Active
1421404864ActiveSupplier 6Partially ActivePartially ActivePartially Active
1521404871ActiveSupplier 6Partially ActivePartially ActivePartially Active
16Supplier 721794878InactiveSupplier 7Partially ActiveInactiveInactive
1721810988InactiveSupplier 7Partially ActivePartially ActiveInactive
18
19
Sheet1
Cell Formulas
RangeFormula
E2:E17E2=IF(ISBLANK(A2),E1,A2)
F2:F17F2=IF(COUNTIF(E:E,E2)=1,C2,IF(AND(COUNTIFS(E:E,E2,C:C,"Active")>0,COUNTIFS(E:E,E2,C:C,"Inactive")=0),C2,"Partially Active"))
G2:G17G2=IF(COUNTIF(A:A,A2)=1,C2,IF(AND(COUNTIFS(A:A,A2,C:C,"Active")>0,COUNTIFS(A:A,A2,C:C,"Inactive")=0),"Active",IF(AND(COUNTIFS(A:A,A2,C:C,"Active")=0,COUNTIFS(A:A,A2,C:C,"Inactive")>0),"Inactive","Partially Active")))
H2:H17H2=IF(COUNTIF(E:E,E2)=1,C2,IF(AND(COUNTIFS(E:E,E2,C:C,"Active")>0,COUNTIFS(E:E,E2,C:C,"Inactive")=0),C2,IF(AND(COUNTIFS(E:E,E2,C:C,"Active")>0,COUNTIFS(E:E,E2,C:C,"Inactive")>0),"Partially Active","Inactive")))
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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