Count the Number of Unique Sequences

William53

New Member
Joined
Jul 8, 2017
Messages
37
Office Version
  1. 365
Platform
  1. Windows
xl2bb.xlsx
BCDEFGH
10-1516-3031-4546-6061-7576-90
21001108
32001114
41111004
50001004
61001107
70201104
81111114
90120214
100000015
110011004
120011104
131200203
141001106
152001113
161111003
170001003
181001105
190201103
201111113
210120213
220000014
230011003
240011103
251200202
260201102
271111112
280120212
290000013
302001112
311111002
320001002
331001104
340011002
350011102
360000111
370000012
380201111
391001103
402001111
411111001
420001001
431001102
440201101
451111111
460120211
470000011
480011001
490011101
501200201
511001101
Goal Time
Cell Formulas
RangeFormula
H2:H51H2=SUM(--(MMULT(--(B2:G2=B2:G51),SEQUENCE(6,,,0))=6))


Kind Regards

William
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
H2 should be: =SUM(--(MMULT(--(B2:G2=B$2:G$51),SEQUENCE(6,,,0))=6))

I think you want?

=ROWS(UNIQUE(B2:G51))
=13
 
Upvote 0
Hi Stephen
What you advised works really well and gives me the total unique rows. I played with the formula for a bit and used =Unique(B2:G51) and it actually gave me the 13 rows of unique sequences. What I would like to do but I cannot seem to find the right combination of formulae to do it, is to count each of those individual rows to find out how many times they occur in the main data?
Is this even possible?

Kind Regards
William
xl2bb.xlsx
BCDEFGHIJKLMNOP
10-1516-3031-4546-6061-7576-90
21001108
3200111413
41111004
50001004
61001108100110
70201104200111
81111114111100
90120214000100
100000015020110
110011004111111
120011104012021
131200203000001
141001108001100
152001114001110
161111004120020
170001004000011
181001108020111
190201104
201111114
210120214
220000015
230011004
240011104
251200203
260201104
271111114
280120214
290000015
302001114
311111004
320001004
331001108
340011004
350011104
360000111
370000015
380201111
391001108
402001114
411111004
420001004
431001108
440201104
451111114
460120214
470000015
480011004
490011104
501200203
511001108
52
Goal Time
Cell Formulas
RangeFormula
J3J3=ROWS(UNIQUE(B2:G51))
J6:O18J6=UNIQUE(B2:G51)
H2:H51H2=SUM(--(MMULT(--(B2:G2=B$2:G$51),SEQUENCE(6,,,0))=6))
Dynamic array formulas.
 
Upvote 0
You could use a similar formula to your MMULT construction in Post #1.

Or another way:

ABCDEFGHIJKLMNOP
10-1516-3031-4546-6061-7576-90
21001108
32001114
41111004
50001004
610011081001108
702011042001114
811111141111004
901202140001004
1000000150201104
1100110041111114
1200111040120214
1312002030000015
1410011080011004
1520011140011104
1611110041200203
1700010040000111
1810011080201111
190201104
201111114
210120214
220000015
230011004
240011104
251200203
260201104
271111114
280120214
290000015
302001114
311111004
320001004
331001108
340011004
350011104
360000111
370000015
380201111
391001108
402001114
411111004
420001004
431001108
440201104
451111114
460120214
470000015
480011004
490011104
501200203
511001108
52
Sheet1
Cell Formulas
RangeFormula
J6:O18J6=UNIQUE(B2:G51)
P6:P18P6=SUM(--BYROW(B$2:G$51=J6:O6,LAMBDA(r,AND(r))))
H2:H51H2=SUM(--(MMULT(--(B2:G2=B$2:G$51),SEQUENCE(6,,,0))=6))
Dynamic array formulas.
 
Upvote 0
Solution
Many many thanks Stephen.
This worked perfectly and now I can analyse all my son's football matches to show when each of the results occur, especially goals conceded :)
I have never used LAMBDA before so researched it. I get the BYROW bit and that it uses the LAMBDA across the data to give a single answer and the SUM part adds them up.
What I don't get is the (r,AND(r) part of the function.
If it is not too much trouble, could you explain?

Kind Regards
William
 
Upvote 0
The two parts of the LAMBDA are:
1) The name I'm using to designate the row - I've used r, and
2) What I want to do with each row, r.

Here's a simpler example which just calculates row totals:

ABCDEF
1
21236
345615
478924
5
Sheet1
Cell Formulas
RangeFormula
E2:E4E2=BYROW(B2:D4,LAMBDA(MyRow,SUM(MyRow)))
Dynamic array formulas.


And here's the formula from Post #4 broken down into steps:

ABCDEFGHIJKLMNOPQRS
1Test
21001108<-- In one step
38<-- Step3 - Add the TRUEs
4
50-1516-3031-4546-6061-7576-90Step1 - compare all 50Step2 - check whole row matches
6100110TRUETRUETRUETRUETRUETRUETRUE
7200111FALSETRUETRUETRUETRUEFALSEFALSE
8111100TRUEFALSEFALSETRUEFALSETRUEFALSE
9000100FALSETRUETRUETRUEFALSETRUEFALSE
10100110TRUETRUETRUETRUETRUETRUETRUE
11020110FALSEFALSETRUETRUETRUETRUEFALSE
12111111TRUEFALSEFALSETRUETRUEFALSEFALSE
13012021FALSEFALSEFALSEFALSEFALSEFALSEFALSE
14000001FALSETRUETRUEFALSEFALSEFALSEFALSE
15001100FALSETRUEFALSETRUEFALSETRUEFALSE
16001110FALSETRUEFALSETRUETRUETRUEFALSE
17120020TRUEFALSETRUEFALSEFALSETRUEFALSE
18100110TRUETRUETRUETRUETRUETRUETRUE
19200111FALSETRUETRUETRUETRUEFALSEFALSE
20111100TRUEFALSEFALSETRUEFALSETRUEFALSE
21000100FALSETRUETRUETRUEFALSETRUEFALSE
22100110TRUETRUETRUETRUETRUETRUETRUE
23020110FALSEFALSETRUETRUETRUETRUEFALSE
24111111TRUEFALSEFALSETRUETRUEFALSEFALSE
25012021FALSEFALSEFALSEFALSEFALSEFALSEFALSE
26000001FALSETRUETRUEFALSEFALSEFALSEFALSE
27001100FALSETRUEFALSETRUEFALSETRUEFALSE
28001110FALSETRUEFALSETRUETRUETRUEFALSE
29120020TRUEFALSETRUEFALSEFALSETRUEFALSE
30020110FALSEFALSETRUETRUETRUETRUEFALSE
31111111TRUEFALSEFALSETRUETRUEFALSEFALSE
32012021FALSEFALSEFALSEFALSEFALSEFALSEFALSE
33000001FALSETRUETRUEFALSEFALSEFALSEFALSE
34200111FALSETRUETRUETRUETRUEFALSEFALSE
35111100TRUEFALSEFALSETRUEFALSETRUEFALSE
36000100FALSETRUETRUETRUEFALSETRUEFALSE
37100110TRUETRUETRUETRUETRUETRUETRUE
38001100FALSETRUEFALSETRUEFALSETRUEFALSE
39001110FALSETRUEFALSETRUETRUETRUEFALSE
40000011FALSETRUETRUEFALSETRUEFALSEFALSE
41000001FALSETRUETRUEFALSEFALSEFALSEFALSE
42020111FALSEFALSETRUETRUETRUEFALSEFALSE
43100110TRUETRUETRUETRUETRUETRUETRUE
44200111FALSETRUETRUETRUETRUEFALSEFALSE
45111100TRUEFALSEFALSETRUEFALSETRUEFALSE
46000100FALSETRUETRUETRUEFALSETRUEFALSE
47100110TRUETRUETRUETRUETRUETRUETRUE
48020110FALSEFALSETRUETRUETRUETRUEFALSE
49111111TRUEFALSEFALSETRUETRUEFALSEFALSE
50012021FALSEFALSEFALSEFALSEFALSEFALSEFALSE
51000001FALSETRUETRUEFALSEFALSEFALSEFALSE
52001100FALSETRUEFALSETRUEFALSETRUEFALSE
53001110FALSETRUEFALSETRUETRUETRUEFALSE
54120020TRUEFALSETRUEFALSEFALSETRUEFALSE
55100110TRUETRUETRUETRUETRUETRUETRUE
56
Sheet1
Cell Formulas
RangeFormula
P2P2=SUM(--BYROW(B$6:G$55=I2:N2,LAMBDA(r,AND(r))))
P3P3=SUM(--P6:P55)
I6:N55I6=B$6:G$55=I2:N2
P6:P55P6=AND(I6:N6)
Dynamic array formulas.
 
Upvote 0
Hi Stephen
Thanks for the extra information, very informative to my novice ability.
I really appreciate the extra time taken.
Not sure if I should mark it as a solution, please advise.
Kind Regards
William
 
Upvote 0

Forum statistics

Threads
1,214,659
Messages
6,120,784
Members
448,992
Latest member
prabhuk279

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