How many set could be formed.

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Hello,

Using 4 digit 0,1,2,3 in the row how many set could be formed which sum could be = 14
Note: each single digit can be used 0-to14 times too.

Like this example

[TABLE="width: 400"]
<tbody>[TR]
[TD="class: xl24, width: 80, bgcolor: transparent"]0
[/TD]
[TD="class: xl24, width: 80, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, width: 80, bgcolor: transparent"]2
[/TD]
[TD="class: xl24, width: 80, bgcolor: transparent"]3
[/TD]
[TD="class: xl24, width: 80, bgcolor: transparent"]Sum
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]14
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl25, bgcolor: transparent"]7
[/TD]
[TD="class: xl25, bgcolor: transparent"]3
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl25, bgcolor: transparent"]5
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl25, bgcolor: transparent"]6
[/TD]
[TD="class: xl25, bgcolor: transparent"]5
[/TD]
[TD="class: xl25, bgcolor: transparent"]2
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]2
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl25, bgcolor: transparent"]7
[/TD]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl25, bgcolor: transparent"]8
[/TD]
[TD="class: xl25, bgcolor: transparent"]2
[/TD]
[TD="class: xl25, bgcolor: transparent"]3
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl25, bgcolor: transparent"]8
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl25, bgcolor: transparent"]7
[/TD]
[TD="class: xl25, bgcolor: transparent"]6
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]3
[/TD]
[TD="class: xl25, bgcolor: transparent"]5
[/TD]
[TD="class: xl25, bgcolor: transparent"]5
[/TD]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]2
[/TD]
[TD="class: xl25, bgcolor: transparent"]6
[/TD]
[TD="class: xl25, bgcolor: transparent"]5
[/TD]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl25, bgcolor: transparent"]9
[/TD]
[TD="class: xl25, bgcolor: transparent"]3
[/TD]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]3
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl25, bgcolor: transparent"]6
[/TD]
[TD="class: xl25, bgcolor: transparent"]1
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]2
[/TD]
[TD="class: xl25, bgcolor: transparent"]6
[/TD]
[TD="class: xl25, bgcolor: transparent"]4
[/TD]
[TD="class: xl25, bgcolor: transparent"]2
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]14
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]14
[/TD]
[TD="class: xl25, bgcolor: transparent"]14
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
[TR]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]0
[/TD]
[TD="class: xl25, bgcolor: transparent"]14
[/TD]
[TD="class: xl24, bgcolor: transparent"]14
[/TD]
[/TR]
</tbody>[/TABLE]


Thank you all
Excel 2000
Regards,
Moti
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I suspect that's the 15th Tetrehedral number which would be 680. You can generate all possible sets like this:

Code:
Public Sub GenerateSets()

Const targetValue = 14

Dim nextRow As Long

Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long

nextRow = 1
For a = 0 To targetValue
    For b = 0 To targetValue - a
        For c = 0 To targetValue - a - b
            d = targetValue - a - b - c
            nextRow = nextRow + 1
            Cells(nextRow, 1) = a
            Cells(nextRow, 2) = b
            Cells(nextRow, 3) = c
            Cells(nextRow, 4) = d
        Next c
    Next b
Next a

End Sub

WBD
 
Upvote 0
I suspect that's the 15th Tetrehedral number which would be 680. You can generate all possible sets like this:

Code:
Public Sub GenerateSets()

Const targetValue = 14

Dim nextRow As Long

Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long

nextRow = 1
For a = 0 To targetValue
    For b = 0 To targetValue - a
        For c = 0 To targetValue - a - b
            d = targetValue - a - b - c
            nextRow = nextRow + 1
            Cells(nextRow, 1) = a
            Cells(nextRow, 2) = b
            Cells(nextRow, 3) = c
            Cells(nextRow, 4) = d
        Next c
    Next b
Next a

End Sub

WBD
Wow! wideboydixon,

This is perfect - thank you very much!

Regards,
Moti :)

 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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
Back
Top