Math puzzle

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158
There are pairings and values are received one from each scale. Small scale numbers are always unique. We have sum of values that are used. We know that pairings are either summed or not. Based on sum we need the function to return which index in the array was used.

The goal is to build deciphering function to return which pairings were used to create the sum. For ex: Can you figure out which pairings were used to make the sum?

<b>Excel</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="border-right: 1px solid black;;">large scale:</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">600</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">400</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">800</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">800</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="border-right: 1px solid black;;">small scale:</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">50</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">51</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">63</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">64</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;"></td><td style="text-align: right;border-top: 1px solid black;;"></td><td style="text-align: right;border-top: 1px solid black;;"></td><td style="text-align: right;border-top: 1px solid black;;"></td><td style="text-align: right;border-top: 1px solid black;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">sum:</td><td style="text-align: right;;">1965</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><br/>
 
Last edited:

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158
Sum of pairings that were used. Edited the original post. mikerickson, does that make sense?
 
Last edited:

B___P

Active Member
Joined
Oct 31, 2015
Messages
419
Each couple (pairings) may be inolved in the sum (1) or not (0). You have to implement a distribution with repetition method to cicle all possible solutions and keep only those matching your sum. I think the light is on but turns off if the pairing are a lot: for 12 pairings you have to test 2^12 possible solutions.

Bye
 

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158

ADVERTISEMENT

Each couple (pairings) may be inolved in the sum (1) or not (0). You have to implement a distribution with repetition method to cicle all possible solutions and keep only those matching your sum. I think the light is on but turns off if the pairing are a lot: for 12 pairings you have to test 2^12 possible solutions.

Bye

how to build recursion function that returns the index of the array that is (1)?
 
Last edited:

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158

ADVERTISEMENT


Thanks for reply B_P. That is the correct direction but was this possible with VBA solution (pseudocode) in cases when there are many more permutations?

It would have 3 parameters =DecipherFunction("B1:E1","B2:E2","B4") and it would return array "1,2,4"
 
Last edited:

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,779
Office Version
  1. 2010
Platform
  1. Windows
The vertical pairs are irrlevent, right? So it just reduces to finding the combination of a set of numbers that add to a given total, a problem that has been well explored on this and other forums.
 

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158
Hello shg, not sure why you said vertical pairs were irrelevant. some of them might not count toward the sum. The task is to use code to decipher the sum to the pairings (one from large scale one from small scale).
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,779
Office Version
  1. 2010
Platform
  1. Windows
Right. But for a given vertical pair, you either use both or neither, so it is only their sum that matters, yes?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,316
Members
414,053
Latest member
Dual Showman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top