How to convert Excel values into buckets?

后端 未结 12 2521
青春惊慌失措
青春惊慌失措 2021-02-20 15:48

I have a set of data in Excel and in one column is a estimate (number of weeks)

I want an Excel formula to bucket it into

  • Small
  • Medium
  • La
12条回答
  •  你的背包
    2021-02-20 16:13

    I use this trick for equal data bucketing. Instead of text result you get the number. Here is example for four buckets. Suppose you have data in A1:A100 range. Put this formula in B1:

    =MAX(ROUNDUP(PERCENTRANK($A$1:$A$100,A1) *4,0),1)
    

    Fill down the formula all across B column and you are done. The formula divides the range into 4 equal buckets and it returns the bucket number which the cell A1 falls into. The first bucket contains the lowest 25% of values.

    Adjust the number of buckets according to thy wish:

    =MAX(ROUNDUP(PERCENTRANK([Range],[OneCellOfTheRangeToTest]) *[NumberOfBuckets],0),1)
    

    The number of observation in each bucket will be equal or almost equal. For example if you have a 100 observations and you want to split it into 3 buckets (like in your example) then the buckets will contain 33, 33, 34 observations. So almost equal. You do not have to worry about that - the formula works that out for you.

提交回复
热议问题