View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Random Numbers and Me

Hi,

I think the 70/20/10 rule will be impossible to achieve exactly because (for
example) with 101 names how may are in each group bearing in mind were using
integers.

This should give a good approximation with your list of people on column A
of the active sheet

Sub randoms()
Dim FirstRange As Range
Dim SecondRange As Range
Dim ThirdRange As Range
Dim LastRow as Long
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set FirstRange = Range("A1:A" & Int(lastrow * 0.7))
Set SecondRange = Range("A" & Int((lastrow * 0.7)) + 1 & ":A" & Int(lastrow
* 0.9))
Set ThirdRange = Range("A" & Int((lastrow * 0.9) + 1) & ":A" & lastrow)

For Each c In FirstRange
c.Offset(, 1) = 1.2 * Rnd
Next

For Each c In SecondRange
c.Offset(, 1) = 1.25 - 1.21 * Rnd
Next

For Each c In ThirdRange
c.Offset(, 1) = 1 * Rnd
Next
End Sub
--
Mike

When competing hypotheses are equal, adopt the hypothesis that introduces
the fewest assumptions while still sufficiently answering the question.
Occam''s razor (Abbrev)


"John Pivot Table" wrote:

Hey!

I´m having a little problem generating a few random numbers. The thing is
this: I have a huge list of people and I need to assign a random number
between 0.0 and 1.25 to each one.

The problem is I need the following:

70% of people to have a number between 1 and 1.2
20% of people to have a number greater than 1.2
10% of people to have a number below 1

Do you know how to do this???

Thanks!!