Need formula to identify identical row values across columns and assign them to groups if identical

michaelm55

New Member
Joined
Nov 17, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
My spreadsheet has hundreds of stores on the Y axis and hundreds of part numbers on the X axis. The values are quantities of the parts per store. I'm aiming to use a formula to find the all of the stores that have the same numbers of parts and group them.

1605656331360.png
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
i would sum the columns and then you can use that column to sort and group together
you could add the word "group" using a concatenate if needed
="Group "&SUM(B3:J3)
 
Upvote 0
Welcome to the MrExcel forum!

Try:

Dynamic functions.xlsm
ABCDEFGHIJK
1Part Numbers
2StoresF262338F262339F262977F262978G253739G253741G253751G253748G253760Group
31761412111
41781412111
517464121212
61745412123
71762412123
817634112124
91777528121
Sheet6
Cell Formulas
RangeFormula
K3:K9K3=IFERROR(INDEX(K$2:K2,MATCH(MMULT(--(B3:J3<>""),2^{0;1;2;3;4;5;6;7;8}),MMULT(--(B$2:J2<>""),2^{0;1;2;3;4;5;6;7;8}),0)),MAX(K$2:K2)+1)


Since you have Excel 365, you can use SEQUENCE instead:

=IFERROR(INDEX(K$2:K2,MATCH(MMULT(--(B3:J3<>""),2^SEQUENCE(9)),MMULT(--(B$2:J2<>""),2^SEQUENCE(9)),0)),MAX(K$2:K2)+1)
 
Upvote 0
Welcome to the MrExcel forum!

Try:

Dynamic functions.xlsm
ABCDEFGHIJK
1Part Numbers
2StoresF262338F262339F262977F262978G253739G253741G253751G253748G253760Group
31761412111
41781412111
517464121212
61745412123
71762412123
817634112124
91777528121
Sheet6
Cell Formulas
RangeFormula
K3:K9K3=IFERROR(INDEX(K$2:K2,MATCH(MMULT(--(B3:J3<>""),2^{0;1;2;3;4;5;6;7;8}),MMULT(--(B$2:J2<>""),2^{0;1;2;3;4;5;6;7;8}),0)),MAX(K$2:K2)+1)


Since you have Excel 365, you can use SEQUENCE instead:

=IFERROR(INDEX(K$2:K2,MATCH(MMULT(--(B3:J3<>""),2^SEQUENCE(9)),MMULT(--(B$2:J2<>""),2^SEQUENCE(9)),0)),MAX(K$2:K2)+1)

Welcome to the MrExcel forum!

Try:

Dynamic functions.xlsm
ABCDEFGHIJK
1Part Numbers
2StoresF262338F262339F262977F262978G253739G253741G253751G253748G253760Group
31761412111
41781412111
517464121212
61745412123
71762412123
817634112124
91777528121
Sheet6
Cell Formulas
RangeFormula
K3:K9K3=IFERROR(INDEX(K$2:K2,MATCH(MMULT(--(B3:J3<>""),2^{0;1;2;3;4;5;6;7;8}),MMULT(--(B$2:J2<>""),2^{0;1;2;3;4;5;6;7;8}),0)),MAX(K$2:K2)+1)


Since you have Excel 365, you can use SEQUENCE instead:

=IFERROR(INDEX(K$2:K2,MATCH(MMULT(--(B3:J3<>""),2^SEQUENCE(9)),MMULT(--(B$2:J2<>""),2^SEQUENCE(9)),0)),MAX(K$2:K2)+1)
Hi and thank you very much for your help. After implementing the formula, I see that it works on the cell contents as uploaded. I also see that if I modify an empty cell in a row, it responds by correctly creating a new group, as it knows that it is now different than the other row(s) in the group. However, if I change an existing cell value in the row, it does not recognize the change and does not create a new group.
 
Upvote 0
i would sum the columns and then you can use that column to sort and group together
you could add the word "group" using a concatenate if needed
="Group "&SUM(B3:J3)
Hello and thank you very much for your help here. Your approach works perfectly for the data uploaded and assuming it does not change. However, if I change G3 to zero and H3 to one, they will still sum to 9 and therefore be seen as part of the same group, which they are not since the two stores are no longer receiving the same qtys of the same parts, which is what makes them members of the same group. Is there a tweak that you could offer to accommodate for changes?
 
Upvote 0
Hi and thank you very much for your help. After implementing the formula, I see that it works on the cell contents as uploaded. I also see that if I modify an empty cell in a row, it responds by correctly creating a new group, as it knows that it is now different than the other row(s) in the group. However, if I change an existing cell value in the row, it does not recognize the change and does not create a new group.
I didn't realize that you also wanted the values to match, not just whether you had some of each part or not. You can try this variation:

Book2
ABCDEFGHIJK
1Part Numbers
2StoresF262338F262339F262977F262978G253739G253741G253751G253748G253760Group
31761412111
41781412111
517464121212
61745412123
71762412123
817634112124
91777412123
1012346115
Sheet2
Cell Formulas
RangeFormula
K4:K10K4=IFERROR(INDEX(K$3:K3,MATCH(MMULT(--B4:J4,10^{0;1;2;3;4;5;6;7;8}),MMULT(--B$3:J3,10^{0;1;2;3;4;5;6;7;8}),0)),MAX(K$3:K3)+1)
Press CTRL+SHIFT+ENTER to enter array formulas.


Put a 1 in K3, then put in the K4 formula and drag down. The 10 in the formula (2 places) must be bigger than the largest number of parts you can find in the table. However, if it gets too big you might start running against maximum precision restrictions of Excel. I'll play around a bit more, but this may be more suited to a User-Defined Function written in VBA.
 
Upvote 0

Forum statistics

Threads
1,214,874
Messages
6,122,036
Members
449,062
Latest member
mike575

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