Finding largest total of ANY two values in a data set

July 12th, 2012 - 08:03 am ET by H3dgehog | Report spam
Good morning,

I have a list of percentage values in a column (totalling 100%). I hav
to run 3 specific tests against this data set:

1) Find the highest sum total of ANY two values, returning the total an
the two values that make up the total.

2) Find the highest sum total of ANY three values, returning the tota
and the three values that make up the total.

3) Find the highest sum total of ANY four values, returning the tota
and the four values that make up the total.

Is there a specific function to look at data sets in this way?

Many thanks in advance from a first time poster


H3dgehog
email Follow the discussionReplies 7 repliesReplies Make a reply

Replies

#1 joeu2004
July 12th, 2012 - 10:50 am ET | Report spam
"H3dgehog" wrote:
I have a list of percentage values in a column (totalling 100%).
I have to run 3 specific tests against this data set:
1) Find the highest sum total of ANY two values, returning the
total and the two values that make up the total.
2) Find the highest sum total of ANY three values, returning the
total and the three values that make up the total.
3) Find the highest sum total of ANY four values, returning the
total and the four values that make up the total.
Is there a specific function to look at data sets in this way?



No. But there is a function that will tell you how many sums you must look
at: =COMBIN(n,k), where n is the total number of values in the list (you
might use COUNT(A1:A100), if you don't want to count them manually), and k
is the number of values to be summed (2, 3 and 4).

For example, if you have a list of 10 percentages, you would need to form
410 sums to find the largest of the sum of 4 values.

The general solution is best implemented using VBA.

However, if you do not want a general solution and your list is of
percentages is very small, you could use the MAX function in which you
enumerate all of the possible sums.

For example, if you have 5 percentages in A1:A5, the largest sum of any 4
is:

=MAX(SUM(A1:A4),SUM(A1:A3,A5),A1+A2+A4+A5,A1+A3+A4+A5,SUM(A2:A5))

Similar topics