+ Reply to Thread
Results 1 to 7 of 7

Multiple conditional formating per column???

Hybrid View

  1. #1
    Registered User
    Join Date
    04-14-2007
    Location
    Phoenix AZ
    Posts
    32

    Multiple conditional formating per column???

    I have a condition allreay that makes the odd numbers red, I would like to make the prime numbers green (all the lower primes except 2 are odd numbers). I think a If condition preceding the Mod would work to find them, but making the font green is another mater! This is the column(s) I enter the data into so in the cell formula box is the lotto number, ????????


    =(MOD(B1:B163,2)<>0)*1

  2. #2
    Forum Contributor
    Join Date
    02-23-2005
    Location
    England
    Posts
    110
    I think what you need to do is 'label' each of your cells as Prime or Not Prime. By this I mean an adjacent cell contains e.g. "Prime" or "Not Prime". You then use the Conditional Formatting Condition 1 to detect the Prime cells (Condition 2 is then used to detect the Odd numbers).

    How should you go about 'labelling' the cells ... Well, you can either do it:
    1. Manually.
    2. Use a macro to set the cell to "Prime" if the cell contents when divided by the Index number of a loop (that loops between 2 and half the maximum value that you will have in your cells) is an Integer.
    3. Use a lookup table, which is really a semi-manual, semi-automatic method.

  3. #3
    Forum Contributor
    Join Date
    02-23-2005
    Location
    England
    Posts
    110
    You might want to try the attached file to see if you can use the relevant bits. (The large area with either empty cells or cells with "1" in them were added purely to check the list of primes.)
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by PeterB
    You might want to try the attached file to see if you can use the relevant bits. (The large area with either empty cells or cells with "1" in them were added purely to check the list of primes.)
    Hi Peter,

    I think that you need to include 47 in your 'Primes' list

    ---
    Si fractum non sit, noli id reficere.

  5. #5
    Forum Contributor
    Join Date
    02-23-2005
    Location
    England
    Posts
    110
    Ooops! Thanks Bryan ... Don't know how I missed that one (brain not functioning). New zipfile attached.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-14-2007
    Location
    Phoenix AZ
    Posts
    32
    Accidently answered my own question..... I didn't notice the Add Button in the Conditional Format Window.

  7. #7
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by PeterB
    I think what you need to do is 'label' each of your cells as Prime or Not Prime. By this I mean an adjacent cell contains e.g. "Prime" or "Not Prime". You then use the Conditional Formatting Condition 1 to detect the Prime cells (Condition 2 is then used to detect the Odd numbers).

    How should you go about 'labelling' the cells ... Well, you can either do it:
    1. Manually.
    2. Use a macro to set the cell to "Prime" if the cell contents when divided by the Index number of a loop (that loops between 2 and half the maximum value that you will have in your cells) is an Integer.
    3. Use a lookup table, which is really a semi-manual, semi-automatic method.
    Hi,

    for numbers 1 to 100 (or so) you can use something like

    =IF(IF(GCD($A1,2)=$A1,1,GCD($A1,2))+IF(GCD($A1,3)=$A1,1,GCD($A1,3))+IF(GCD($A1,5)=$A1,1,GCD($A1,5))+IF(GCD($A1,7)=$A1,1,GCD($A1,7))+IF(GCD($A1,11)=$A1,1,GCD($A1,11))+IF(GCD($A1,13)=$A1,1,GCD($A1,13))+IF(GCD($A1,17)=$A1,1,GCD($A1,17))+IF(GCD($A1,19)=$A1,1,GCD($A1,19))+IF(GCD($A1,23)=$A1,1,GCD($A1,23))=9,"Prime","Not")

    which someone should be able to shorten. GCD is in the Analysis Toolpak Addins (Tools, Addins and tick the Analysis)

    hth
    ---
    added

    on reflection I believe the formula covers up to 29*29 ( 841 ) which will be incorrectly reported as Prime

    ---
    Last edited by Bryan Hessey; 04-24-2007 at 10:40 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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