Forum Discussion
Kreggar
Sep 18, 2025Copper Contributor
Finding Possible Matches to a Solution
Hello Everyone, I'm wondering if anyone has any tricks or formulas that I can use to find any possible combination of numbers that will create the desired solutions I'm looking for. Take a look at t...
Patrick2788
Sep 20, 2025Silver Contributor
The key to begin to solve the problem is to recognize the type of problem.
This is the classic subset sum problem which can be handled by generating all possible combinations without repetition and then selecting only those rows which = target sum.
SubsetSumλ =
LAMBDA(
integers, //array of numbers
target_sum, //return rows which = this target
LET(
//Total numbers
k, COUNT(integers),
//Total combinations
C, SUM(COMBIN(k, SEQUENCE(k))),
//Generate bin array using BITRSHIFT to avoid limits of DEC2BIN
bin, MOD(BITRSHIFT(SEQUENCE(C), SEQUENCE(, k, k - 1, -1)),2),
//Swap binary for integers
M, bin * TOROW(integers),
//Check which rows = target sum
keep, BYROW(M, SUM) = target_sum,
//Deliver results
deliver, FILTER(M, keep, "None"),
deliver));