View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default How to determine the prime numbers?

I know but I couldn't help showing my solution!
That formula that even impressed Bob Umlas
Please forgive me showing off!!!
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Bernard,

That formula works to determine if the entered number is prime, but the OP
wants the first prime that is higher, and the first prime that is lower.

HTH,
Bernie
MS Excel MVP


"Bernard Liengme" wrote in message
...
No need for VBA this time:
=IF(SUMPRODUCT(--(MOD(A1,(ROW(INDIRECT("2:"&INT(SQRT(A1))))))=0))," Not
Prime","Prime")
must be array-entered (ie with SHIFT+CTRL+ENTER)
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Eric" wrote in message
...
Does anyone have any suggestions on how to determine the prime numbers?
There is a given number 10 in cell A2, I would like to determine the
next
prime numbers below and over this given number 10. In this case, 11 will
be
returned in cell A1, and 7 will be returned in A3.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric