I have a dataset in the form of 8 columns (separated based on additional variables that aren't directly relevant here) that vary in size each week and each data point is an effectively random positive integer from 0-100 inclusive.

I am trying to design a function to output the minimum number of data points that sum to at least 50% of the total sum of the column - so if a column happened to be the integers 0-100 then the sum would be 5050 and the desired output would be 30. Additionally as I need to repeat this function 8 separate times I need a solution that is compact - in addition to working with the variable data size.

So far I have tried various SUMIFs and COUNTIFs, but trying to set the range using the LARGE function became recursive and spat out error messages. I also tried a few iterative solutions at first - like setting the minimum range by using the total sum divided by the largest value and increasing the range by 1 until it hit the 50% threshold, but given the dataset could run into the thousands this would not meet my compactness requirement.