Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Eric,
Try this. It will loop from 1 to 1000 and list the primes within that range to column A of the active sheet. Sub mersible() a = 1 For x = 1 To 1000 'Change to suit Dim i As Long If x < 2 Or (x < 2 And x Mod 2 = 0) Or x < Int(x) Then GoTo 100 For i = 3 To Sqr(x) Step 2 If x Mod i = 0 Then GoTo 100 Next Cells(a, 1).Value = x a = a + 1 100 Next End Sub Mike "Eric" wrote: Does anyone have any suggestions on how to generate a list of prime number in excel? such as 2,3,5,7,11,13,17,23,29,31 ... Does anyone know the formula? Thanks in advance for any suggestions Eric |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Generate random number from a list | Excel Worksheet Functions | |||
An add-in that allows you to find the highest prime in a number | Excel Discussion (Misc queries) | |||
how do I find prime factors of a number | Excel Worksheet Functions | |||
How do I test for a prime number? | Excel Worksheet Functions | |||
Prime number puzzle | Excel Worksheet Functions |