# Excel Question-What totals in a range equal this number?

**URL:** <https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841>\
**Category:** Factual Questions\
**Created:** [September 25, 2003, 9:45pm UTC](https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841 "2003-09-25T21:45:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bradjam](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Bradjam](https://boards.straightdope.com/u/Bradjam)\
**Post date:** [September 25, 2003, 9:45pm UTC](https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841/1 "2003-09-25T21:45:25Z")

</div>

Is there a way to take a range of numbers and determine which cells and combination of cells (if any) sum to a particular number? For example:

A1=2  
A2=4  
A3=6  
A4=2

I want to know which cells sum to 8. In this case, it would either be A1+A2+A4 or A3+A4. Obviously, this becomes much more difficult when hundreds of numbers are involved.

Any suggestions would be appreciated.

---

<div class="post-metadata">

**Author:** ![Jpeg\_Jones](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@Jpeg\_Jones](https://boards.straightdope.com/u/Jpeg_Jones)\
**Post date:** [September 25, 2003, 9:51pm UTC](https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841/2 "2003-09-25T21:51:30Z")

</div>

> [@](#):
>
> Obviously, this becomes much more difficult when hundreds of numbers are involved.

Unspeakably difficult, unless all the numbers are 2.

I can think of no automatic way to determine this using Excel or anything else, for that matter. Noodle it out.

Question: What are you trying to accomplish? Perhaps there’s a different way to get there.

---

<div class="post-metadata">

**Author:** ![Bradjam](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Bradjam](https://boards.straightdope.com/u/Bradjam)\
**Post date:** [September 25, 2003, 10:02pm UTC](https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841/3 "2003-09-25T22:02:35Z")

</div>

I’m reconciling two groups of numbers, and I have the total difference between the groups. I suspect that the difference is a combination of 2 or more numbers in one of the groups. The problem is finding those numbers, hence, the mystery formula I need.

---

<div class="post-metadata">

**Author:** ![sailor](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sailor](https://boards.straightdope.com/u/sailor)\
**Post date:** [September 25, 2003, 10:07pm UTC](https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841/4 "2003-09-25T22:07:47Z")

</div>

I cannot think of a way to do it in EXcel but in Basic or any other language it would be a fairly simple, recursive, algorithm.

---

<div class="post-metadata">

**Author:** ![Jpeg\_Jones](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@Jpeg\_Jones](https://boards.straightdope.com/u/Jpeg_Jones)\
**Post date:** [September 25, 2003, 10:12pm UTC](https://boards.straightdope.com/t/excel-question-what-totals-in-a-range-equal-this-number/203841/5 "2003-09-25T22:12:13Z")

</div>

How about this:

Sort both groups ascending, then compare them side-to-side.
