+ Reply to Thread
Results 1 to 4 of 4

Highlight all prime numbers in column

  1. #1
    Registered User
    Join Date
    02-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Highlight all prime numbers in column

    Hi, i wish to highlight all prime numbers within a column.

    How can this be done?

    Thanks.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,111

    Re: Highlight all prime numbers in column

    you can use this formula
    http://www.excelexchange.com/prime_number_test.html
    and put into conditional formatting

    =IF(C1=2,TRUE,IF(AND(MOD(C1,ROW(INDIRECT("2:"&ROUNDUP(SQRT(C1),0))))<>0),TRUE,FALSE))
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    02-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Highlight all prime numbers in column

    Quote Originally Posted by etaf View Post
    you can use this formula
    http://www.excelexchange.com/prime_number_test.html
    and put into conditional formatting

    =IF(C1=2,TRUE,IF(AND(MOD(C1,ROW(INDIRECT("2:"&ROUNDUP(SQRT(C1),0))))<>0),TRUE,FALSE))
    Thanks very much, works great!

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,111

    Re: Highlight all prime numbers in column

    Your welcome, thanks for the rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Array for Finding Prime numbers in a cell
    By Karnik in forum Excel General
    Replies: 6
    Last Post: 11-11-2012, 08:54 PM
  2. Replies: 4
    Last Post: 07-19-2012, 12:43 PM
  3. Prime numbers
    By Gearcutter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-08-2007, 09:03 AM
  4. [SOLVED] question about prime numbers and font sizes
    By Lucas Budlong in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2006, 02:10 AM
  5. [SOLVED] Prime Numbers
    By Flyone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2005, 10:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1