I am looking for a function or at least a streamlined way to split my data into quartiles based on the sum of values grouped by size in Excel (Office 365) i.e. if my company earns $1,000,000.00 a year, I want to know which of the largest customers form the top $250,000.00 and which of the smallest customers form the bottom $250,000.00 of revenue. The challenge I am having is that I need this to be replicable across multiple columns within the same table, even though the values may be ordered differently.
Below is a simplified example of what I am trying to achieve. Given the list of customers and their annual spend for fiscal periods 2020 & 2021, I want to know which customers fall into each quartile of overall revenue for the fiscal period:
Presently, I have a very clunky way to achieve the outcome I desire, but I am convinced that there must be a more efficient way to do this.
Firstly, I calculate the "cumulative" value of each quartile =Table1[[#Totals],[2020]]*0.25, =Table1[[#Totals],[2020]]*0.5 & =Table1[[#Totals],[2020]]*0.75 resulting:
I then create an ordered array using =SORT(Table1[2020]) & =SORT(Table1[2021]) separate from the table itself. This produces:
Followed by adding in columns to calculate the cumulative values using =SUM($G$2:G2) and so on, resulting in:
I then add another column to assign each of the values to a quartile, based on their cumulative values based on the monstrosity - =IF(H2<$B$16,"Quartile 1",IF(H2<$B$17,"Quartile 2",IF(H2<$B$18,"Quartile 3",IF(H2>$B$18,"Quartile 4")))) for each of the cells in the quartile columns, which results in:
Then, just in case there wasn't enough convolution, I port the values back into the original table using =XLOOKUP([@2020],$G$2#,$I$2:$I$11) etc. resulting, finally, in what I actually set out to achieve:
Whilst the values in the original table are a randomised array, as you can imagine, customer spend can vary significantly from year to year, meaning that the quartile (of the sum value) will likely change, so I need to automate this as far as reasonably practicable, ideally linking to an OLAP model once I can get the basic logic ironed out.
I have been pulling my hair out for days trying to figure out if there was a way to manipulate =PERCENTILE.EXC(), =PERCENTRANK.EXC(), =QUARTILE.EXC() and their .INC() counterparts to do this for me, but all of these functions seem only capable of basing results on the counts of cells, not the sum value.
Apologies for the mammoth write-up, but I was struggling to verbalise what I am trying to achieve and thought it would help to see.
Any help will be gratefully received!







