Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2014, 07:26 PM
Bruno Campanini Bruno Campanini is offline How to insert random numbers that equal a certain number Windows 8 How to insert random numbers that equal a certain number Office 2013
Novice
 
Join Date: Nov 2014
Posts: 19
Bruno Campanini is on a distinguished road
Default

In the range of 85 to 645 there are 645-85+1=561 numbers.
If you take the first 21 ones you get a sum of 84*21*22/2 = 19404;
if you get the first 22 ones you get a sum of 84*22*23/2 = 21252;


and so on.
In my opinion there is only one way to get 76 numbers summarizing 20000:
- accepting duplicates by running VBA code.
Is it ok for you?

Bruno
Reply With Quote
  #2  
Old 11-22-2014, 05:48 AM
Bruno Campanini Bruno Campanini is offline How to insert random numbers that equal a certain number Windows 8 How to insert random numbers that equal a certain number Office 2013
Novice
 
Join Date: Nov 2014
Posts: 19
Bruno Campanini is on a distinguished road
Default

Sorry, mis-created series formula:
A1 = 85
r = 1
A76 = a1 + r * (n - 1) = 160
S76 = [n * (n + 2 * a1 -1)] / 2 = 9321

BTW, we must create all combinations of 561 elements taken 76 by 76,
whose number is:
C561,76 > 215385 * 10^90

Mission impossible!

Bruno
Reply With Quote
  #3  
Old 11-22-2014, 06:14 AM
macropod's Avatar
macropod macropod is offline How to insert random numbers that equal a certain number Windows 7 64bit How to insert random numbers that equal a certain number Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Bruno Campanini View Post
Mission impossible!
You obviously haven't tried the solution I posted...

To show how simple it is to get a series of 75 unique numbers that add to 20000, simply insert:
=INT(317.75-ROW()*4/3)
and copy down to row 75. The sum of the rows will be 20000. Granted, these numbers aren't random, but they also go nowhere near exhausting the possibilities contemplated by the OP.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 11-22-2014, 07:50 PM
Bruno Campanini Bruno Campanini is offline How to insert random numbers that equal a certain number Windows 8 How to insert random numbers that equal a certain number Office 2013
Novice
 
Join Date: Nov 2014
Posts: 19
Bruno Campanini is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
You obviously haven't tried the solution I posted...

To show how simple it is to get a series of 75 unique numbers that add to 20000, simply insert:
=INT(317.75-ROW()*4/3)
and copy down to row 75. The sum of the rows will be 20000. Granted, these numbers aren't random, but they also go nowhere near exhausting the possibilities contemplated by the OP.
Well, OP requested 76 random numbers in the range 85 to 645
Your formula gives 75 quasi-successive number in the range 216 to 317.
Honestly you can't consider it neither a solution, nor a pseudo-solution.
Another simpler non-solution is:
Sum 75 successive numbers in the range 227 to 301, plus 200.

The problem is a Linear Programming Problem whose solution can be achieved also with the Simplex Algorithm coded in Excel VBA, but it involves a setup of 561 parameters... which is a very long story.
For sure Mathematica can do the job but it requires either a more complex code or an extraordinary long command line.
Taking into account these difficulties I said Mission Impossible.

Bruno
Reply With Quote
  #5  
Old 11-22-2014, 08:23 PM
whatsup whatsup is offline How to insert random numbers that equal a certain number Windows 7 64bit How to insert random numbers that equal a certain number Office 2010 32bit
Competent Performer
 
Join Date: May 2014
Posts: 137
whatsup will become famous soon enough
Default

Hi again

@Bruno
Quote:
Well, OP requested 76 random numbers in the range 85 to 645
The second time you got it wrong, it's 75 numbers!!! There is no mentioning that the random numbers may not contain duplicates!!!

Any comment on a perfectly working solution the like "wouldn't work", even by replacing it with a statement like "mission impossible" makes me really cross.
If you don't bother to read the question properly, neither to try out provided solutions, please just keep your wisdoms to yourself.

Offering on this theme a solution involving the simplex algorithm is completely offtopic, you read obviously somewhere something, but can't get loose ends fit.

@Paul
Great solution, efficiently and fast, and quite comfortable when using vba for recalculations!

Cheers
Reply With Quote
  #6  
Old 11-23-2014, 06:35 AM
Bruno Campanini Bruno Campanini is offline How to insert random numbers that equal a certain number Windows 8 How to insert random numbers that equal a certain number Office 2013
Novice
 
Join Date: Nov 2014
Posts: 19
Bruno Campanini is on a distinguished road
Default

[quote=whatsup;73911]Hi again

@Bruno

The second time you got it wrong, it's 75 numbers!!!
***
Ok, my second fault... waiting for the third one.


There is no mentioning that the random numbers may not contain duplicates!!!
***
Don't be ridiculous!
If you allow duplicates the simplest formula is:
74*a + b = 20000
where:
a = Int(20000/74) = 270
b = 20000 - 74*a = 20


Offering on this theme a solution involving the simplex algorithm is completely offtopic, you read obviously somewhere something, but can't get loose ends fit.
***
You say Simplex Algorithm is off-topic because you never wrote such a code in Excel VBA.
I did it and it works fine!

Would you like to see it?
If you do, you must confirm me in advance that you know how Simplex works.

Ciao
Bruno
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling cells with random numbers using loops? (VBA) Sajj Excel Programming 4 04-10-2013 02:29 PM
Random number difficulties ahrinn Word 12 08-01-2012 01:04 PM
Random number generator for Powerpoint 2011 kala85 PowerPoint 0 11-19-2011 06:16 AM
How to fill a cell with random numbers to do calculations? zanat0s Excel 1 06-13-2011 10:33 AM
Display Random Numbers as Transition greenbutton PowerPoint 0 03-09-2011 04:43 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft