excel rand() negative


G

Guest

When I run the equation =rand() sometimes I get a negative number, when I
should get a number between 0 and 1. Am I doing something wrong or is this a
glitch? I am running excel 2003.
 
Ad

Advertisements

H

Helmut Weber

Hi Rustin,

here and now not in a million times.

Sub test099856()
Dim lCnt As Long
Randomize
For lCnt = 1 To 1000000
If Rnd() < 0 Then Stop
Next
' Further checking by looking ar the results
For lCnt = 1 To 1000
Cells(lCnt, 1).Value = Rnd()
Next
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Rand() 0
Bias in rand for excel 07 23
Locking RAND()? 3
Possible? -- RAND() 2
Rand function 8
Excel 2003-RND() vs Rand() 4
tricky rand situation 9
RAND() function error? ## 6

Top