Finding most common number in a range

nirvehex

Well-known Member
Joined
Jul 27, 2011
Messages
503
Office Version
  1. 365
Platform
  1. Windows
Hi all - I'm looking to create a formula that will return the most common number in a range. I can't just use the mode function as my list contains decimal numbers and I want to return the most single digit number in the range. In the example table below, the most common number would be 6 as it appears 4 times throughout. Any ideas on a formula that would work for this? Thank you!!

3.67​
3.26​
6.16​
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Like this then?

24 02 25.xlsm
ABCDE
13.6763.23
23.262.32
36.163.2
4
Mode
Cell Formulas
RangeFormula
B1,E1:E2B1=LET(c,SUBSTITUTE(CONCAT(A1:A3),".",""),MODE.MULT(--MID(c,SEQUENCE(LEN(c)),1)))
 
Upvote 0
Thanks Peter, appreciate your help! It worked for a small range, but when I try to adjust for my full range it gives me a #VALUE error. Any ideas on what I'm doing wrong/how to modify? Here is the full range I was testing it on. This range will differ in numbers each time.

Formula used: =LET(c,SUBSTITUTE(CONCAT(B5:B21),".",""),MODE.MULT(--MID(c,SEQUENCE(LEN(c)),1)))

3.54​
3.41​
3.67​
4​
4​
3.75​
1.5​
0.37​
90.00​
62.96​
-1​
0.52​
-1​
-3.16​
-0.68​
102.77​
90.51​
 
Upvote 0
Any ideas on what I'm doing wrong/how to modify?
Yes, you didn't mention or include examples of negative numbers before so as well as the formula removing the decimal points it also needs to remove those "-" signs so we are left with digits only. :)

24 02 25.xlsm
BCD
53.541
63.41
73.67
84
94
103.75
111.5
120.37
1390
1462.96
15-1
160.52
17-1
18-3.16
19-0.68
20102.77
2190.51
Mode (2)
Cell Formulas
RangeFormula
D5D5=LET(c,SUBSTITUTE(SUBSTITUTE(CONCAT(B5:B21),".",""),"-",""),MODE.MULT(--MID(c,SEQUENCE(LEN(c)),1)))
 
Upvote 0
A little shorter if you take the absolute value instead of substitute :)
=LET(c,SUBSTITUTE(CONCAT(ABS(B5:B21)),".",""),MODE.MULT(--MID(c,SEQUENCE(LEN(c)),1)))
 
Upvote 0
Here is another formula, a longer one using a different approach, that will also work...
Excel Formula:
=LET(s,SEQUENCE(10)-1,c,CONCAT(B5:B21),m,MAP(s,LAMBDA(x,LEN(c)-LEN(SUBSTITUTE(c,x,"")))),FILTER(s,m=MAX(m)))
 
Upvote 0
... and another

=LET(s,SEQUENCE(10,,0),L,LEN(SUBSTITUTE(CONCAT(B5:B21),s,"")),FILTER(s,L=MIN(L)))

EDIT: which I now see is just a variation on Rick's
 
Upvote 0
You're welcome. Glad we were able to help. Thanks for the follow-up. :)
 
Upvote 0
Sorry - another question. I'm getting a #SPILL! error when I use this data set below, using this formula: =LET(c,SUBSTITUTE(CONCAT(ABS(B5:B21)),".",""),MODE.MULT(--MID(c,SEQUENCE(LEN(c)),1)))
Does this mean there are two numbers that have the same amount and are the most common?

2.91​
2.55​
3.28​
2.33​
2.67​
2.5​
0​
-0.22​
11.00​
29.41​
-1​
0.45​
-1​
-3.28​
-1.07​
101.01​
90.74​
 
Upvote 0

Forum statistics

Threads
1,215,072
Messages
6,122,968
Members
449,095
Latest member
Mr Hughes

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