I have a column in an Excel spreadsheet that is composed of positive and negative integers (credits and debits from an accounting ledger). I also have a specific value that is the sum of some subset of the integers from the aforementioned column. I want to find out which subset of these integers sum to produce this specific value in question.

In linear algebra terms, I interpret this problem as the following:

$$ \begin{bmatrix} a\_1 & a\_2 & a\_3 & \ldots & a\_n \end{bmatrix}
\begin {bmatrix} x\_1 \\ x\_2 \\ \ldots \\ x\_n \end{bmatrix} = y $$

where:

* $a\_1,a\_2,\ldots,a\_n$ are integers (positive or negative)
* $x\_1,x\_2,\ldots,x\_n$ are restricted to either $0$ or $1$
* $y$ is an integer

Is there a way to solve this programmatically? I am willing to try Wolfram Alpha, Excel tools, some Python script, or any other method. The best I can brainstorm at the moment is a Python script that loops through trying $2^n$ number of possibilities (0 or 1 for each $x\_i$). There must be a better way, no?