Bin Count Distrubution Formula???? Normalized Bin Intervals???

mrmmickle1

Well-known Member
Joined
May 11, 2012
Messages
2,461
I have a large set of data that has Sales Volume in it by State. I want to disperse values into bins based on the distribution. I have cut the data by month and by year. This means that for each month the distribution of Sales Volume will change. I am trying to get a formula that will tell me a good Bin interval. SO the Distribution of Values is in Column D. Right Now I am using trial and error Countif formulas to try to determine the bins based on the values in Column F and G. Is there a formula way to optimize the bin intervals..... In other words get a good distribution of values in all of the bins. So that my Color Gradient will not all be one color. For Example if I set the starting threshold at 100000 then all of my colors would be Dark Red (
2,490,533)... This would not be a good distribution.... I want to display as many colors as possible. So I am looking for a good way to determine the thresholds.. Any Advice or assistance would be greatly appreciated.

Excel 2013
ABCDEFGHI
1AL43601Distribution><ActiveCell.Interior.ColorThreshold
2AR564151003,631,1040
3AZ5031012505,281,818100
4CA267722515006,536,550250
5CO5981050125007,002,534500
6CT2313250175009,170,9052500
7DC2097501200009,167,1027500
8DE0420001400006,401,78920000
9FL57137240001600014,419,06040000
10GA12862060001950004,419,06060000
11IA1971950011000002,490,53395000
12ID0
13IL8306
14IN10049
15KS222
16KY28491
17LA2184
18MA9925
19MD1780
20ME3
21MI25703
22MN0
23MO3551
24MS2113
25MT0
26NC24093
27ND0
28NE1564
29NH346
30NJ2257
31NM7977
32NV71
33NY0
34OH10182
35OK1584
36OR1545
37PA19525
38RI12
39SC14785
40SD0
41TN99732
42TX36158
43UT310
44VA14107
45VT0
46WA0
47WI1387
48WV4293
49WY0
DataSet2
Cell Formulas
RangeFormula
D2=COUNTIF(B1:B49,"<"&G2)
D3=COUNTIFS($B$1:$B$49,">"&F3,$B$1:$B$49,"<"&G3)
D4=COUNTIFS($B$1:$B$49,">"&F4,$B$1:$B$49,"<"&G4)
D5=COUNTIFS($B$1:$B$49,">"&F5,$B$1:$B$49,"<"&G5)
D6=COUNTIFS($B$1:$B$49,">"&F6,$B$1:$B$49,"<"&G6)
D7=COUNTIFS($B$1:$B$49,">"&F7,$B$1:$B$49,"<"&G7)
D8=COUNTIFS($B$1:$B$49,">"&F8,$B$1:$B$49,"<"&G8)
D9=COUNTIFS($B$1:$B$49,">"&F9,$B$1:$B$49,"<"&G9)
D10=COUNTIFS($B$1:$B$49,">"&F10,$B$1:$B$49,"<"&G10)
D11=COUNTIF($B$1:$B$49,">"&F11)
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I think this works, 49 values in total, 40 are unique.

Excel 2010
ABCDE
ALBinsDistribution
AR
AZ
CA
CO
CT
DC
DE
FL
GA
IA
ID
IL
IN
KS
KY
LA
MA
MD
ME
MI
MN
MO
MS
MT
NC
ND
NE
NH
NJ
NM
NV
NY
OH
OK
OR
PA
RI
SC
SD
TN
TX
UT
VA
VT
WA
WI
WV
WY

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]43601[/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]564[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]10[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]50[/TD]
[TD="align: right"][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]2677[/TD]
[TD="align: right"][/TD]
[TD="align: right"]24[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]598[/TD]
[TD="align: right"][/TD]
[TD="align: right"]144[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]231[/TD]
[TD="align: right"][/TD]
[TD="align: right"]320[/TD]
[TD="align: right"]3[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]20[/TD]
[TD="align: right"][/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]4[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"]1704[/TD]
[TD="align: right"]7[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]57137[/TD]
[TD="align: right"][/TD]
[TD="align: right"]5516[/TD]
[TD="align: right"]0[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]12862[/TD]
[TD="align: right"][/TD]
[TD="align: right"]7104[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]197[/TD]
[TD="align: right"][/TD]
[TD="align: right"]8316[/TD]
[TD="align: right"]14[/TD]

[TD="align: center"]12[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]

[TD="align: right"]8306[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]

[TD="align: right"]10049[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]15[/TD]

[TD="align: right"]222[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]16[/TD]

[TD="align: right"]28491[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]17[/TD]

[TD="align: right"]2184[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]18[/TD]

[TD="align: right"]9925[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]19[/TD]

[TD="align: right"]1780[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]20[/TD]

[TD="align: right"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]21[/TD]

[TD="align: right"]25703[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]22[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]23[/TD]

[TD="align: right"]3551[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]24[/TD]

[TD="align: right"]2113[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]25[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]26[/TD]

[TD="align: right"]24093[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]27[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]28[/TD]

[TD="align: right"]1564[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]29[/TD]

[TD="align: right"]346[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]30[/TD]

[TD="align: right"]2257[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]31[/TD]

[TD="align: right"]7977[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]32[/TD]

[TD="align: right"]71[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]33[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]34[/TD]

[TD="align: right"]10182[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]35[/TD]

[TD="align: right"]1584[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]36[/TD]

[TD="align: right"]1545[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]37[/TD]

[TD="align: right"]19525[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]38[/TD]

[TD="align: right"]12[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]39[/TD]

[TD="align: right"]14785[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]40[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]41[/TD]

[TD="align: right"]99732[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]42[/TD]

[TD="align: right"]36158[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]43[/TD]

[TD="align: right"]310[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]44[/TD]

[TD="align: right"]14107[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]45[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]46[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]47[/TD]

[TD="align: right"]1387[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]48[/TD]

[TD="align: right"]4293[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]49[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]D3[/TH]
[TD="align: left"]{=SMALL(IF(FREQUENCY($B$1:$B$49,$B$1:$B$49)>0,$B$1:$B$49),ROWS($1:1))*(SUM(IF(FREQUENCY($B$1:$B$48,$B$1:$B$49)>0,1))/10)*ROW(1:1)}[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]E2:E11[/TH]
[TD="align: left"]{=FREQUENCY($B$1:$B$49,$D$3:$D$11)}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]


The general idea is this:

Count the unique values, I think 40 in this example.
Divide by the number of desired distributions, 10 in this example.
This will give us 4, we can then use a nth highest value using multiple of 4 so

4th highest, 8th highest, 12th highest etc.......

These 10 values then feed the Distribution count.


......Well, that's the theory anyway.
 
Last edited:
Upvote 0
I think this is alittle better although I'm not convinced.


Excel 2010
ABCDE
2AL43601BinsDistribution
3AR56414
4AZ50504
5CA26772314
6CO5985984
7CT23115844
8DC2022574
9DE079774
10FL57137101824
11GA12862195254
12IA197361583
Sheet1
Cell Formulas
RangeFormula
D4=SMALL($B$2:$B$50,COUNTIF($B$2:$B$50,MIN($B$2:$B$50))+(SUM(IF(FREQUENCY($B$2:$B$49,$B$2:$B$50)>0,1))/10)*ROW(1:1))
E3:E12{=FREQUENCY($B$2:$B$50,$D$4:$D$12)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Comfy,

Sorry, for the delayed response I was writing a macro for my co-worker.

Thanks so much!! The last formula set looks like it will work for my needs!! This has saved me a huge amount of time. :) Without your help I was going to have to manually fiddle with the bins 39 times then make a grid of all of the bins so I could index the appropriate bin distribution for each of 39 different scenarios. Your Awesome!
 
Upvote 0
Comfy,

Sorry, for the delayed response I was writing a macro for my co-worker.

Thanks so much!! The last formula set looks like it will work for my needs!! This has saved me a huge amount of time. :) Without your help I was going to have to manually fiddle with the bins 39 times then make a grid of all of the bins so I could index the appropriate bin distribution for each of 39 different scenarios. Your Awesome!

You're Welcome.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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