How to find the most frequent combination in a dataset.

winds

Board Regular
Joined
Mar 9, 2022
Messages
71
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hello. I have a dataset that goes something like this

texttypechangecharactervaluereason
Alfredabad
Bettyacacgs
Charlievvvgd

The letters in the columns do not matter (it's actually numbers, I'm just altering the data for privacy purposes). But basically, I want to know in this data set, which is the most common combination. In this simple example, the highest combination can be taken from type, value and character where they occur three times. Second highest would be reason and change, and the least would be text.

The actual data set is much larger hence the need for some.. method.
 
Here's a semi-manual way of the first question. I would post your second question in a new thread. Make sure you indicate version 2019 as you have both listed on your profile.
x
Step 1: Find the count of each column.
Book1
ABCDEFG
1texttypechangecharactervaluereason
2Alfredabad
3Bettyacacgs
4Charlievvvgd
5
6Count232332
Sheet9
Cell Formulas
RangeFormula
B6:G6B6=COUNTA(B2:B4)


Step 2: Paste the column headers and the count as values in a table format.
Book1
IJ
1HeaderCount
2type2
3character3
4value2
5text3
6change3
7reason2
Sheet9


Step 3: Highlight the table in step 2 -> Data Tab -> Sort ->
Screen Shot 2024-03-29 at 11.29.45 PM.png


Final Result:
Book1
LM
1HeaderCount
2type3
3character3
4value3
5text2
6change2
7reason2
Sheet9
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
With out version 365 dynamic functions. I don't see an easy way to accomplish what you're asking for. Maybe VBA is an option. Not sure I can assist further.
Hi. I've transferred to my 365 version. Unfortunately I'm getting #REF under the Frequency and Header Columns. For COUNT it only displays the formula next to it. I'm getting the formula in this cell contains an error for the COUNT area.
 
Last edited:
Upvote 0
You're probably not referencing the ranges correctly. I can't diagnosis without seeing what you entered.
 
Upvote 0
You're probably not referencing the ranges correctly. I can't diagnosis without seeing what you entered.
0​
0​
0​
0​
0​
82​
5​
13​
0​
0​
0​
100​
0​
0​
0​
0​
0​
0​
0​
0​
0​
0​
21​
0​
0​
21​
42​
14​
0​
28​
0​
42​
0​
11​
0​
0​
0​
11​
0​
10​
41​
51​
17​
0​
38​
26​
24​
0​
14​
119​
58​
0​
10​
0​
22​
0​
16​
17​
123​
0​
27​
0​
22​
0​
49​
0​
0​
17​
0​
17​
0​
16​
35​
0​
35​
86​
8​
0​
17​
25​
0​
30​
17​
23​
14​
39​
20​
143​
0​
0​
21​
0​
19​
0​
0​
17​
57​
13​
25​
8​
0​
19​
65​
0​
0​
10​
20​
30​
0​
3​
0​
12​
14​
29​
18​
57​
17​
92​
25​
31​
106​
36​
101​
69​
45​
413​
22​
29​
39​
37​
77​
49​
46​
56​
355​
44​
51​
29​
61​
82​
267​
45​
46​
56​
38​
185​
27​
29​
35​
24​
26​
141​
14​
30​
22​
66​
15​
46​
9​
37​
21​
91​
43​
262​
0​
21​
8​
26​
25​
27​
9​
17​
133​
7​
17​
29​
48​
32​
133​
16​
22​
15​
32​
85​
24​
61​
38​
36​
36​
195​
18​
26​
16​
60​
47​
7​
0​
0​
0​
48​
0​
102​
27​
0​
21​
0​
0​
28​
27​
22​
125​
5​
0​
29​
0​
38​
72​
0​
0​
0​
31​
31​
19​
57​
0​
31​
0​
107​
0​
0​
0​
0​
0​
0​
0​
0​
0​
0​
0​
0​
16​
15​
0​
0​
0​
0​
0​
0​
31​
137​
0​
0​
0​
0​
137​
0​
0​
0​
0​
0​
0​
0​
0​
0​
9​
9​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​
7​

I've left out the headings for privacy purposes. All the 7 I tried using COUNTA instead.
 
Upvote 0
You have 0's instead of blanks compared to your original post. They're not the same. Adjust the range.

Excel Formula:
=BYCOL(A1:A6,LAMBDA(col,COUNTIF(col,"<>0")))
 
Upvote 0
You have 0's instead of blanks compared to your original post. They're not the same. Adjust the range.

Excel Formula:
=BYCOL(A1:A6,LAMBDA(col,COUNTIF(col,"<>0")))
Ok getting somewhere now. How do I add a new formula so the headers is for column A instead of text, character and value?
 
Upvote 0
I don't understand what you mean.
If we go back to the first example, it accurately shows the criteria like reason and text however is it also possible to show the criteria in column A which is Alfred Betty and Charlie.
 
Upvote 0
Can you show what the expected results you want from the first example? It's unclear how you want to show it.
 
Upvote 0
FrequencyHeadersAdditional column..
3type, character, valueA,C,V
2change, reasonC,V
2textA,C
5-C,V

This is in reference to the 2nd example that I edited.

And the last one I added where to see how many regardless of the other data surrounding it.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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