Need help on Permutation & Occurance Count

DigitNoob

New Member
Joined
May 4, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello, need help from you guys on permutation.
if I have a large amount of data .. say tens of columns & hundreds of rows of it.. each with 4 digit of numbers.
And I would like to count the occurance of certain numbers and all of its permutations…
For example if i want to find out the occurance of 3589 & all its permutations, the result will show 3.
And it will list down 3859 in row 2, 3895 in row 4 & 9835 in row 12 respectively ..? (see attachment here)
Appreciate if anybody who is expert in excel can guide me along. Thanks in advance.
 

Attachments

  • Permutation & Count .jpg
    Permutation & Count .jpg
    184 KB · Views: 23

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
This seems to work based on the test data. Here is a formula, for the permutations, that you will need for the final solution.

PERMUTX
Excel Formula:
=LAMBDA(
    range,repitition,
        LET(
            v,range,
            c,COUNTA(v),
            n,MID(TEXT(BASE(SEQUENCE(PERMUTATIONA(c,c),,0),c),REPT("0",c)),SEQUENCE(,c),1)+1,
            pa,INDEX(v,n),
            nj,BYROW(pa,LAMBDA(ro,TEXTJOIN(,,ro))),
            f,BYROW(nj,LAMBDA(ro,SUM(IF(LEN(ro)-LEN(SUBSTITUTE(ro,v,"")),1,0))=c)),
            IF(repitition,pa,FILTER(pa,f))
        )
)

digit_noob
ABCDEFGHIJKLM
14853866378426681320685362242420194136321Find:3859
23859110176269529145514393076538224321083Permutations:3
36900109635771580203177493840940963559729
49011984414433895331579546946706128711579
59290613876282895127525498228479190948590
66224104910564501553899827761349331753238
71636674443964003661096022192761853552961
83233272192273214471339751858752753815192
98673490245389422406685824559559090504508
104403917575783487761626723075738237205827
116531561810251188184939886624199660916312
125047668946807300803049075897983562594534
Sheet2
Cell Formulas
RangeFormula
M2M2=SUM(BYROW(PermutX(MID(M1,SEQUENCE(LEN(M1)),1),0),LAMBDA(br,SUM(--(A1:J12=CONCAT(br)+0)))))
 
Upvote 1
Hi fren Irobbo314, many thanks for your guidance. I paste SUM(BYROW).... formulas into worksheet but i received "#Name?" message.
Could it be the typo error? How to solve it? appreciate ur help. tq.
 
Upvote 0
Hi fren, also i see there is a PERMUTX & Lambda formula as mentioned above.. how to apply this ya..?
Sorry for so many questions.. as i am not expert in programming & excel. many thanks for your help. Cheers.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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