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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I think this works, 49 values in total, 40 are unique.

Excel 2010
ABCDE
1AL43601BinsDistribution
2AR56410
3AZ5003
4CA2677242
5CO5981444
6CT2313203
7DC2010004
8DE017047
9FL5713755160
10GA1286271042
11IA197831614
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

<tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
D3{=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)}
E2:E11{=FREQUENCY($B$1:$B$49,$D$3:$D$11)}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>


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,215,657
Messages
6,126,057
Members
449,284
Latest member
fULMIEX

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