Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Difficulty adding RAND generated numbers

Having difficulty adding rand generated numbers, trying to create practice
worksheets for students using basic operations and integers.
A1: can be interchangable with +,-,x,or/
B2 C2 are the upper limits of numbers
B3 C3 the lower limits
B4...B23 is a rand() using B2 and B3 as limits; formula =RAND()*(B$2-B$3)+B$3
C4...C23 is a rand() using C2 and C3 as limits; formula =RAND()*(C$2-C$3)+C$3

Problem arises HERE when trying to create solution sheet:
=SUMPRODUCT(($A$1="+")*($B4+$C4)+($A$1="-")*($B4-$C4)+($A$1="X")*($B4*$C4)+IF($B4<"",($A$1="/")*($B4/$C4),0))
Solutions are frequently off, e.q. generated numbers "5+19" solution sheet
says "25" is it something with the way the numbers are generated?
Perplexed!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default Difficulty adding RAND generated numbers

RAND() is volatile; it recalculates every time the spreadsheet is
recalculated. Perhaps that is screwing up your calculations. Why not
generate a list of random numbers, copy them, paste them as values, and then
run your other formulas off those values?

Dave
--
Brevity is the soul of wit.


"47u2caryj" wrote:

Having difficulty adding rand generated numbers, trying to create practice
worksheets for students using basic operations and integers.
A1: can be interchangable with +,-,x,or/
B2 C2 are the upper limits of numbers
B3 C3 the lower limits
B4...B23 is a rand() using B2 and B3 as limits; formula =RAND()*(B$2-B$3)+B$3
C4...C23 is a rand() using C2 and C3 as limits; formula =RAND()*(C$2-C$3)+C$3

Problem arises HERE when trying to create solution sheet:
=SUMPRODUCT(($A$1="+")*($B4+$C4)+($A$1="-")*($B4-$C4)+($A$1="X")*($B4*$C4)+IF($B4<"",($A$1="/")*($B4/$C4),0))
Solutions are frequently off, e.q. generated numbers "5+19" solution sheet
says "25" is it something with the way the numbers are generated?
Perplexed!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 174
Default Difficulty adding RAND generated numbers

Your formulas in B4 and C4 generaterandom numbers that may not be integers so
when you see 5 + 19 the underlying values might be 5.8 and 19.9 so when
added, this will show 25 if your result is formatted to show whole numbers
only.

To generate random integers change to

=INT(RAND()*(B$2-B$3+1)+B$3)

or, using RANDBETWEEN from Analysis ToolPak add-in

=RANDBETWEEN(B$2,B$3)

Additionally.....are you really using SUMPRODUCT as quoted? I wouldn't think
that's the most appropriate or efficient formula, perhaps try

=CHOOSE(MATCH($A$1,{"+","-","x","/"},0),B4+C4,B4-C4,B4*C4,B4/C4)





"47u2caryj" wrote:

Having difficulty adding rand generated numbers, trying to create practice
worksheets for students using basic operations and integers.
A1: can be interchangable with +,-,x,or/
B2 C2 are the upper limits of numbers
B3 C3 the lower limits
B4...B23 is a rand() using B2 and B3 as limits; formula =RAND()*(B$2-B$3)+B$3
C4...C23 is a rand() using C2 and C3 as limits; formula =RAND()*(C$2-C$3)+C$3

Problem arises HERE when trying to create solution sheet:
=SUMPRODUCT(($A$1="+")*($B4+$C4)+($A$1="-")*($B4-$C4)+($A$1="X")*($B4*$C4)+IF($B4<"",($A$1="/")*($B4/$C4),0))
Solutions are frequently off, e.q. generated numbers "5+19" solution sheet
says "25" is it something with the way the numbers are generated?
Perplexed!

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
Why are 1/2 my numbers imported as text and the rest as numbers? KBear Excel Discussion (Misc queries) 2 April 21st 06 01:40 PM
ADDING NEW NUMBERS TO EXISTING WORKSHEET KwithanE New Users to Excel 1 January 8th 06 04:42 PM
Adding to a column of numbers Colleen Excel Worksheet Functions 1 January 4th 06 06:26 AM
Adding numbers in a single cell chefcasey Excel Worksheet Functions 1 September 14th 05 06:51 AM
adding only positive numbers Jacob Excel Discussion (Misc queries) 2 November 30th 04 12:24 AM


All times are GMT +1. The time now is 07:33 PM.

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"