FG

Find combination of values with sum closest to number

Fresh3 days ago
Mar 15, 202638741 views
Confidence Score0%
0%

Problem

I've got a column of numbers, and I'd like to find the best combination of three of these numbers. In our case, the best combination is a sum that is as close as possible to our goal number. For example, we have a goal of 100 and this column of numbers: If I sum this group of 3 numbers (30,70,0) is…

Error Output

15
70
36
60
30
53
37
17
0
75
100
9

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Find combination of values with sum closest to number

Low Risk

One method is by using Solver Put your data in A1:A12 In B13, put a formula =SUMPRODUCT(A1:A12,B1:B12) Set up solver so that B1:12 must be binary (ie 1 or 0) In B14 put a "target" score, 100 in your example in B15 put =ABS(B13-B14) Set solver to loo…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment