Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trying to F9 sum of random numbers until certain value is reached

New to macros.....

I'm trying to convince an engineer that there are many possibilities t
a tolerance stackup.

Cells A1:A10 are nominal dimensions. The value doesn't matter.

Cells B1:B10 are all randomly generated plus values from .001 to .060.

Cells C1:C10 are all randomly generate minus values from -.001 t
-.060.

Cell C11 is sum(B1:C10).

What I do is hit F9 until my arm falls off until C11 is .030.

That's what the engineer is looking for over 10 dimensions, .030.

I want a macro to calculate until C11 = .030

I'm trying to show that there are many possibilities.

I read the Visual Basic help pages for hours but defer to you, th
experts.

What I have started with is:

Sub Regen()
If C11 < .030 Then
Calculate
End If
End Sub

I know that won't work because it doesn't.

Thanks in advance

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Trying to F9 sum of random numbers until certain value is reached

Take a look at Goal Seek in Help.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"langba " wrote in message
...
New to macros.....

I'm trying to convince an engineer that there are many possibilities to
a tolerance stackup.

Cells A1:A10 are nominal dimensions. The value doesn't matter.

Cells B1:B10 are all randomly generated plus values from .001 to .060.

Cells C1:C10 are all randomly generate minus values from -.001 to
-.060.

Cell C11 is sum(B1:C10).

What I do is hit F9 until my arm falls off until C11 is .030.

That's what the engineer is looking for over 10 dimensions, .030.

I want a macro to calculate until C11 = .030

I'm trying to show that there are many possibilities.

I read the Visual Basic help pages for hours but defer to you, the
experts.

What I have started with is:

Sub Regen()
If C11 < .030 Then
Calculate
End If
End Sub

I know that won't work because it doesn't.

Thanks in advance.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trying to F9 sum of random numbers until certain value is reached

Thanks. I don't think Goal Seek is what I'm looking for. Unless I'
using it wrong. Help wasn't helpful

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trying to F9 sum of random numbers until certain value is reached



In B1 I put

=ROUND(RAND()*0.059+0.001,3)+0*D1

in B2 I put
=ROUND(RAND()*0.059+0.001,3)
and copied B2 down

In C1 I put
=-1*=ROUND(RAND()*0.059+0.001,3)

In E1 i put

=Sum(B1:C10)

Leave D1 blank or put in any number

I then did goalseek and specified

Set Cell E1
To value .03
by changing cell D1

D1 is just a dummy cell to stimulate calculation.

In tools options, I changed Max iterations to 1000 under the calculate tab.


Worked consistently for me.

--
Regards,
Tom Ogilvy






"langba " wrote in message
...
Thanks. I don't think Goal Seek is what I'm looking for. Unless I'm
using it wrong. Help wasn't helpful.


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trying to F9 sum of random numbers until certain value is reached

Just to clarify

In C1 I put
=-1*=ROUND(RAND()*0.059+0.001,3)

and copied that down to C10 (same with the formula in B2, copied down to
B10)

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...


In B1 I put

=ROUND(RAND()*0.059+0.001,3)+0*D1

in B2 I put
=ROUND(RAND()*0.059+0.001,3)
and copied B2 down

In C1 I put
=-1*=ROUND(RAND()*0.059+0.001,3)

In E1 i put

=Sum(B1:C10)

Leave D1 blank or put in any number

I then did goalseek and specified

Set Cell E1
To value .03
by changing cell D1

D1 is just a dummy cell to stimulate calculation.

In tools options, I changed Max iterations to 1000 under the calculate

tab.


Worked consistently for me.

--
Regards,
Tom Ogilvy






"langba " wrote in message
...
Thanks. I don't think Goal Seek is what I'm looking for. Unless I'm
using it wrong. Help wasn't helpful.


---
Message posted from http://www.ExcelForum.com/







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Trying to F9 sum of random numbers until certain value is reached

I'm trying to convince an engineer that there are many possibilities to
a tolerance stackup.


If all you are doing is trying to "convince", then here is just one way.
Put .060 in B1, and -.030 in C1. This totals your .030.
Then whatever you put in B2, put the negative in C2.
If C3=-B3 (copied down), then the Total will always add to .030.
Another way would be to generate Random numbers in the remaining B2:B10, and
just rearrange the negative of these same numbers in C2:C10.

You could then put .050 in B1 and -.020 in C1, for a total of .030. Etc.
As you can see, there are many possibilities.

When using Solver or Goal Seek, I often find it easy to scale the problem.
In other words, multiply everything by 1000. You are generating numbers
from +- 1-60, and looking for a sum of 30.

Most likely, you will never test for an exact .030 due to rounding issues
(from what I see)

If C11 < .030 Then


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"langba " wrote in message
...
New to macros.....

I'm trying to convince an engineer that there are many possibilities to
a tolerance stackup.

Cells A1:A10 are nominal dimensions. The value doesn't matter.

Cells B1:B10 are all randomly generated plus values from .001 to .060.

Cells C1:C10 are all randomly generate minus values from -.001 to
-.060.

Cell C11 is sum(B1:C10).

What I do is hit F9 until my arm falls off until C11 is .030.

That's what the engineer is looking for over 10 dimensions, .030.

I want a macro to calculate until C11 = .030

I'm trying to show that there are many possibilities.

I read the Visual Basic help pages for hours but defer to you, the
experts.

What I have started with is:

Sub Regen()
If C11 < .030 Then
Calculate
End If
End Sub

I know that won't work because it doesn't.

Thanks in advance.


---
Message posted from http://www.ExcelForum.com/




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Numbers excluding Previous Numbers Brad Excel Worksheet Functions 2 July 23rd 09 12:25 AM
getting numbers divisible by 4 from random numbers in ascending order ramana Excel Worksheet Functions 6 June 19th 07 06:41 PM
Can Excel pick random numbers from 1-300 and not repeat numbers? Julian Excel Discussion (Misc queries) 1 June 7th 06 07:17 AM
Non-random numbers generated by excel's data analysis random gener Allie Excel Worksheet Functions 10 September 17th 05 06:19 AM
Non-random numbers generated by excel's data analysis random gener Harlan Grove Excel Discussion (Misc queries) 2 September 13th 05 04:06 PM


All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"