Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Practice Math Problems

Hello,

I'm guessing this should be a relatively easy problem, but I can't figure it
out.

I want to make a sheet of practice math problems for 2nd graders. I've got
the addition sheet figured out:
column x
row 1 =randbetween(1,10)
row 2 =randbetween(1,10)

and an '+ in the cell: (row 2, column x-1)

The subtraction page is the trigger for my question. I would like the same
randomized numbers, but don't want to have the kids (2nd graders!) deal with
negative numbers. Is there a way to get Excel to check the row above and set
the upperbound of the "randbetween" to that number? Would that create an
endless 'do loop' in Excel?

Many thanks,
M John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Practice Math Problems

Just use this in place of your other random code
Randomize
iNumber = Int((10 - 1 + 1) * Rnd + 1)

i number will be a random number between 1 and 10, 10 is the upperbound and
both 1's are the lower
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"M John" wrote:

Hello,

I'm guessing this should be a relatively easy problem, but I can't figure it
out.

I want to make a sheet of practice math problems for 2nd graders. I've got
the addition sheet figured out:
column x
row 1 =randbetween(1,10)
row 2 =randbetween(1,10)

and an '+ in the cell: (row 2, column x-1)

The subtraction page is the trigger for my question. I would like the same
randomized numbers, but don't want to have the kids (2nd graders!) deal with
negative numbers. Is there a way to get Excel to check the row above and set
the upperbound of the "randbetween" to that number? Would that create an
endless 'do loop' in Excel?

Many thanks,
M John

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Practice Math Problems


The following code fills in 5 random numbers between Zero and Ten in row 5 and 6.
If any number in row 6 is larger than the number above it then the two
numbers are switched.
The Analysis ToolPak in "Tools | Add-ins" must be checkmarked.
'---
Sub PositiveAnswersOnlyWhenSubtracting()
Dim dblTemp As Double
Dim rCell As Range
Range("B5:F6").Formula = "=RandBetween(0,10)"
Range("B5:F6").Value = Range("B5:F6").Value
For Each rCell In Range("B6:F6")
If rCell.Value rCell(0, 1).Value Then
dblTemp = rCell.Value
rCell.Value = rCell(0, 1).Value
rCell(0, 1).Value = dblTemp
End If
Next
Set rCell = Nothing
End Sub
---

You may want to try out my free "Math Practice" workbook available upon
direct request to those who provide a name and location.
XX (remove the XXX)

It has two difficulty levels, but both of those are more difficult than the level you specify.
It keeps a record of the time / correct answers and provides a chart showing those.
It has separate, random exercises for Adding, Subtracting, Multiplying, Dividing and
Fractions.
'--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"M John"
wrote in message
Hello,

I'm guessing this should be a relatively easy problem, but I can't figure it
out.

I want to make a sheet of practice math problems for 2nd graders. I've got
the addition sheet figured out:
column x
row 1 =randbetween(1,10)
row 2 =randbetween(1,10)

and an '+ in the cell: (row 2, column x-1)

The subtraction page is the trigger for my question. I would like the same
randomized numbers, but don't want to have the kids (2nd graders!) deal with
negative numbers. Is there a way to get Excel to check the row above and set
the upperbound of the "randbetween" to that number? Would that create an
endless 'do loop' in Excel?

Many thanks,
M John
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
Best Practice CWillis Excel Discussion (Misc queries) 2 June 27th 06 04:40 PM
Good Practice Ardus Petus Excel Programming 4 February 22nd 06 08:06 PM
Best Practice Ardus Petus Excel Programming 7 February 20th 06 03:14 AM
best practice? hsibbs Excel Discussion (Misc queries) 7 June 17th 05 04:11 AM
Need Some Practice Linc Excel Programming 3 November 26th 03 01:36 PM


All times are GMT +1. The time now is 01:01 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"