Search code examples
google-sheetsgoogle-sheets-formula

How many top customers contribute to 80% of revenue?


I am trying to figure out if there is a formula that can help me calculate "How many top customers contribute to 80% of revenue?".

I have a spreadsheet with Column A for the account names and Column B for their associated sales number.

Based on my online research most solutions recommended figuring out how many percent each account contributes to the total sales number. I have calculated this in Column C but unable to figure out a formula that would use this percentage to count the number of top accounts that would contribute to 80% of the total sales.

Sample Spreadsheet

Thank you in advance!


Solution

  • Numbers doesn't add up exactly to 80%. To include first value exceeding and adding to 82.69%:

    =arrayformula(sum(N(SCAN(0,C2:C41,LAMBDA(a,b,a+b))<0.8)))+1
    

    To exclude exceeding value and adding to 79.76%:

    =arrayformula(sum(N(SCAN(0,C2:C41,LAMBDA(a,b,a+b))<0.8)))
    

    Result:

    enter image description here

    Note that these formulas works if column C is sorted descending. Sort your range first:

    =arrayformula(sum(N(SCAN(0,sort(C2:C41,1,),LAMBDA(a,b,a+b))<0.8)))+1