How to find all combinations that equal a given sum in Excel? (2022)

For example, I have the following list of numbers, and now, I want to know which combination of numbers in the list sum up to 480, in the following screenshot shown, you can see there are five groups of possible combinations that add up equal to 480, such as 300+60+120, 300+60+40+80, etc. This article, I will talk about some methods to find which cells sum up to a specific value in Excel.

How to find all combinations that equal a given sum in Excel? (1)

  • Find cells combination that equal a given sum with formulas
  • Find cells combination that equal a given sum with Solver Add-in
  • Find cells combination that equal a given sum with User Defined Function
  • Find all combinations that equal a given sum with an amazing feature

Find cells combination that equal a given sum with formulas

First, you need to create some range names, and then apply an array formula to find the cells that sum to the target value, please do with the following step by step:

1. Select the number list and define this list a range name-- Range1 into the Name Box, and press Enter key to finish the range name defined, see screenshot:

How to find all combinations that equal a given sum in Excel? (2)

2. After defining a range name for the number list, then you need to create two further range names in the Name Manager box, please click Formulas > Name Manager, in the Name Manager dialog box, click New button, see screenshots:

How to find all combinations that equal a given sum in Excel? (3)How to find all combinations that equal a given sum in Excel? (4)How to find all combinations that equal a given sum in Excel? (5)

3. In the popped out New Name dialog, enter a name List1 into the Name field, and type this formula =ROW(INDIRECT("1:"&ROWS(Range1))) (Range1 is the range name you have created in step1) into the Refers to field, see screenshot:

How to find all combinations that equal a given sum in Excel? (6)

4. Click OK to return to the Name Manager dialog, then continue to click New button to create another range name, in the New Name dialog, enter a name List2 into the Name field, and type this formula =ROW(INDIRECT("1:"&2^ROWS(Range1))) (Range1 is the range name you have created in step1) into the Refers to field, see screenshot:

How to find all combinations that equal a given sum in Excel? (7)

5. After creating the range names, please apply the following array formula into cell B1:

=IF(ISNUMBER(MATCH(ROWS($1:1),IF(INDEX(MOD(INT((List2-1)/2^(TRANSPOSE(List1)-1)),2),MATCH(TRUE,MMULT(MOD(INT((List2-1)/2^(TRANSPOSE(List1)-1)),2),Range1)=$C$2,0),),TRANSPOSE(List1)),0)),"X",""), and press Shift + Ctrl + Enter keys together, then drag the fill handle down to cell B8, the last number of the list, and you can see the numbers which total amount is 480 are marked as X in column B, see screenshot:

How to find all combinations that equal a given sum in Excel? (8)

(Video) How To Find All Combinations That Equal A Given Sum In Excel

  • Notes:
  • In the above long formula: List1, List2 and Range1 are the range names you have created in former steps, C2 is the specific value that you want numbers added up to.
  • If more than one combination of values has a sum equal to the specific value, only one combination is listed.

Find and list all combinations that equal a given sum quickly and easily in Excel

Kutools for Excel's Make Up A Number utility can help you to find and list all combinations and specific combinations that equal to a given sum number quickly and easily. Click to download Kutools for Excel!

How to find all combinations that equal a given sum in Excel? (9)

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now!

Find cells combination that equal a given sum with Solver Add-in

If you are confused with above method, Excel contains a Solver Add-in feature, by using this add-in, you can also identify the numbers which total amount equals a given value.

1. First, you need to activate this Solver add-in, please go to File > Options, in the Excel Options dialog box, click Add-Ins from the left pane, and then click Solver Add-in from the Inactive Application Add-ins section, see screenshot:

How to find all combinations that equal a given sum in Excel? (10)

2. Then click Go button to enter the Add-Ins dialog, check Solver Add-in option, and click OK to install this add-in successfully.

How to find all combinations that equal a given sum in Excel? (11)

3. After activating the Solver add-in, then you need to enter this formula into the cell B9: =SUMPRODUCT(B2:B9,A2:A9), (B2:B9 is a blank column cells beside your number list, and A2:A9 is the number list that you use. ), and press Enter key, see screenshot:

How to find all combinations that equal a given sum in Excel? (12)

(Video) How to Find random numbers that total to a given Amount or Value Using Excel..

4. Then click Data > Solver to go to the Solver Parameter dialog box, in the dialog, please do the following operations:

(1.) Click How to find all combinations that equal a given sum in Excel? (13) button to select the cell B10 where your formula in from the Set Objective section;

(2.) Then in the To section, select Value Of, and enter your target value 480 as you need;

(3.) Under the By Changing Variable Cells section, please click How to find all combinations that equal a given sum in Excel? (14) button to select cell range B2:B9 where will mark your corresponding numbers.

How to find all combinations that equal a given sum in Excel? (15)

5. And then click Add button to go to the Add Constraint dialog box, click How to find all combinations that equal a given sum in Excel? (16) button to select cell range B2:B9, and select bin from the drop down list, see screenshot:

How to find all combinations that equal a given sum in Excel? (17)

6. Click OK to go back the Solver Parameter dialog, then click Solve button, some minutes later, a Solver Results dialog box is popped out, and you can see the combination of cells which equal a given sum 480 are marked as 1. In the Solver Results dialog, please select Keep Solver Solution option, and click OK to exit the dialog. See screenshot:

How to find all combinations that equal a given sum in Excel? (18)

Note: This method is also only can get one combination cells if there are more than one combination of values has a sum equal to the specific value.

Find cells combination that equal a given sum with User Defined Function

The first two methods are all complex for most of our Excel users, here, I can create a VBA code to solve this job quickly and easily.

To get the correct result, you must sort the number list in descending order first. And then do with the following steps:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

(Video) combination of all possible sum for a given number solver

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Find cells combination that equal a given sum:

Function GetCombination(CoinsRange As Range, SumCellId As Double) As String'updateby Extendoffice Dim xStr As String Dim xSum As Double Dim xCell As Range xSum = SumCellId For Each xCell In CoinsRange If Not (xSum / xCell < 1) Then xStr = xStr & Int(xSum / xCell) & " of " & xCell & " " xSum = xSum - (Int(xSum / xCell)) * xCell End If Next GetCombination = xStrEnd Function

3. Then save and close this code window, and then go back to the worksheet, and enter this formula =getcombination(A2:A9,C2) into a blank cell, and press Enter key, you will get the following result which displays the combination numbers that equal a given sum, see screenshot:

How to find all combinations that equal a given sum in Excel? (19)

  • Notes:
  • In the above formula, A2:A9 is the number range, and C2 contains the target value you want to equal to.
  • If more than one combination of values has a sum equal to the specific value, only one combination is listed.

Find all combinations that equal a given sum with an amazing feature

Maybe all of the above methods are somewhat difficult for you, here, I will introduce a powerful-tool, Kutools for Excel, with its Make Up A Number feature, you can quickly get all combinations that equal to a given sum.

Tips:To apply this Make Up A Number feature, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.

After installing Kutools for Excel, please do as this:

1. Click Kutools > Content > Make Up A Number, see screenshot:

How to find all combinations that equal a given sum in Excel? (20)

2. Then, in the Make up a number dialog box, please click How to find all combinations that equal a given sum in Excel? (21) button to select the number list that you want to use from the Data Source, and then enter the total number into the Sum textbox, see screenshot:

How to find all combinations that equal a given sum in Excel? (22)

3. And then, click OK button, a prompt box will pop out to remind you to select a cell to locate the result, see screenshot:

(Video) Excel: use Solver and SumMatch to find numbers that add up to your target sum

How to find all combinations that equal a given sum in Excel? (23)

4. Then, click OK, and now, all combinations that equal to that given number have been displayed as below screenshot shown:

How to find all combinations that equal a given sum in Excel? (24)

Click to Download Kutools for Excel and free trial Now!

Demo: Find cells combination that equal a given sum in Excel

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, chartsand anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.

Read More... Free Download... Purchase...

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

Read More... Free Download... Purchase...

(Video) Find numbers in sum [Excel Solver]

FAQs

How do you find all the combinations that equal a sum in Excel Solver? ›

Find cells combination that equal a given sum with Solver Add-in. If you are confused with above method, Excel contains a Solver Add-in feature, by using this add-in, you can also identify the numbers which total amount equals a given value.

Can Excel find all possible combinations? ›

Get all possible combinations from multiple lists in Excel using Power ...

How do you find random numbers that total to a given amount or value using Excel? ›

Enter the formula =randbetween(50,150) in cells G11:G16, and =sum(g11:g16) in cell G18. This will generate 6 random numbers between 50 and 150, and their sum. If you target value is in D18, then the following will refresh the random values until the values in D18 and G18 are equal.

How do you generate all possible combinations of one list? ›

To create the list of all possible combinations:
  1. Click the Expand button in the column header. From the sub-menu: Select only the column with the data we wish to retain (i.e., in our example, uncheck the Temp column) ...
  2. The list of possible combinations now appears in the Power Query window.
Feb 14, 2021

How do you find the combinations of 4 numbers in Excel? ›

Select a blank cell and type this formula =TEXT(ROW(A1)-1,"0000") into it, and press Enter key, then drag the autofill handle down until all the 4 digits combinations are listing.

How do you generate or list all possible permutations in Excel? ›

The Excel PERMUTATIONA function returns the number of permutations (combinations where order is significant) for a given number of items. The PERMUTATIONA function allows repetitions. To calculate the number of permutations without repetitions, use the PERMUT function. number - The total number of items.

How do you generate all three combinations of multiple columns in Excel? ›

Generate all combinations based on 3 or multiple columns of data by using an awesome feature
  1. Click Kutools > Insert > List All Combinations, see screenshot:
  2. In the List All Combinations dialog box, specify the columns data and separators for listing the combinations as following screenshot shown:

How do you find a random number total to a given amount or value? ›

Generate Random Numbers that Adds Up to a Certain Amount - YouTube

How do you find a number that equals a sum in solver? ›

Start Excel 2007 Solver
  1. Press with left mouse button on "Data" in the Ribbon.
  2. Press with left mouse button on "Solver"
  3. Press with left mouse button on "Set Target Cell:" button.
  4. Press with left mouse button on B12.
  5. Type in "Value of:" window the summed value 2615,4.
Feb 24, 2018

How does the Randbetween function work? ›

The RANDBETWEEN Function[1]is categorized under Excel Math and Trigonometry functions. The function will return a random integer number between the user-specified numbers. It will return a random integer number every time the worksheet is opened or calculated.

How do you find a number that equals a sum in Solver? ›

Using Excel To Identify Entries That Add To A Specific Value.mp4

Can you sum an index match? ›

Using the SUMIFS function and INDEX & MATCH functions inside, you can add more than 1 criterion that is not possible with the SUMIF function. In SUMIFS functions, you have to input the Sum Range first, then Criteria Range, as well as Range Criteria, will be placed.

How do you find all the combinations that equal a sum in Python? ›

First, we take an empty list 'res' and start a loop and traverse each element of the given list of integers. In each iteration, pop the element, store it in 'num', find remaining difference for sum K, and check if the difference exists in the given list or not.

Videos

1. COMBIN Function in Excel 2013 - Calculate Combinations and Permutations
(Excel Destination)
2. Excel Solver - find 2 numbers that Sum to a value
(Amir Parmar)
3. How to Identify Numbers that Add Up to a Specific Value using Solver Add-in of Excel
(The Data Magic With Wilson Powlous)
4. Combination of Numbers from 1 to N having Sum 'N' | Backtracking Tutorial | Combination Sum
(RedCoder)
5. Quickly Get All Combinations of Multiple Lists in Excel
(Up4Excel)
6. Create all possible combinations of two lists of values in Excel
(Indzara Excel Templates)

You might also like

Latest Posts

Article information

Author: Ms. Lucile Johns

Last Updated: 09/12/2022

Views: 6156

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.