Excel: How to Use the Sieve Macro to Find Prime Numbers

Last reviewed: November 29, 1994
Article ID: Q58543
The information in this article applies to:
  • Microsoft Excel for the Macintosh, versions 2.2, 3.0, 4.0

SUMMARY

A macro sheet named Sieve is included with the "Microsoft Excel Technical Reference for the Macintosh" manual on the Technical Reference Guide disk in the "Macro Examples" folder.

The Sieve macro is designed to find all of the prime numbers between 0 and a maximum that the user supplies. A prime number is any number that can only be divided evenly by itself and 1.

To operate the macro, follow these instructions:

  1. Open the file called "Sieve".

  2. Press COMMAND+OPTION+P (or choose Run from the Macro menu, select Sieve!Primes, and click OK).

  3. Input the maximum whole number at the prompt. Press RETURN or click OK.

  4. At the next prompt, click OK to watch the macro work or Cancel to continue without watching the macro work.


KBCategory: kbmacro
KBSubcategory:

Additional reference words: 2.2 2.20 3.0 3.00 4.0 4.00 macrosheet


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 29, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.