+ Reply to Thread
Results 1 to 7 of 7

Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

  1. #1
    Registered User
    Join Date
    06-27-2005
    Posts
    8

    Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    I have an office lottery pool. Each of us pick 6 numbers from a range of 1 through 60. This is on sheet1. Sheet2 contains the actual drawn numbers. Rows on sheet2 are labelled by week number. I want all the cells in sheet1 to have conditional formatting that will change the cell color to red if they match any cell from the cells that contain the drawn numbers in sheet2. Can someone please help me on this?

    I actually asked this question in a LibreOffice forum because thats what I have at home and thought that maybe it would work for Excel at my work place. But unfortunately the answer I got only works for LibreOffice. I understand that cross posting is frowned upon but I really would like to know how I can get this to work on Excel. Below is what i got to work in the other spread sheet program. I will attache my document without any conditional formatting. Thanks.

    Condition 1 Dropdown:
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Apply Style:
    Please Login or Register  to view this content.
    Cell Range
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    22,772

    Re: Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    In Excel you can't refer explicitly to a range reference in another sheet with conditional formatting. To get round this, however, you just need to define a named range.

    So, I defined a named range call numbers to cover the range B1 to F10 in Sheet2, in order to allow you to add some more data as the weeks unfold.

    Then I select the range B2:F41 in Sheet1 (again, to allow new names to be added), then clicked on Conditional Formatting | New Rule | Use a formula... , and then put this formula in the dialogue box:

    =AND(B2<>"",COUNTIF(numbers,B2))

    Then you can click on the Format button | Fill tab and choose Red, and then OK your way out. Excel will automatically adjust the cell references to suit all the cells that had been selected, and colour the appropriate cells red.

    Hope this helps.

    Pete

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    12,402

    Re: Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    Depending on your version of Xl (I think you need 2010 or newer) try.
    Select B2:G38 & use this formula
    =SUMPRODUCT(--(B2=Sheet2!$B$1:$F$52))
    Attached Files Attached Files
    Last edited by Fluff13; 12-19-2019 at 11:48 AM.

  4. #4
    Registered User
    Join Date
    10-24-2019
    Location
    Australia
    MS-Off Ver
    Version 1909 (Build 12026.20334) Monthly Channel
    Posts
    7

    Re: Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    Hi, i had a similar issue (link to relevant thread added by moderator: https://www.excelforum.com/excel-gen...-formulas.html).

    my solution changes the information in sheet 2 to a table (table1) and uses the indirect function to get around conditional formatting's quirks, i generated a formula to punch out true or false depending if there was a match
    the formula (in cell I2) is the conditional formatting formula ( i used in cell b2, then modified the conditional formatting rule to cover the rest of the data on sheet 1.
    Attached Files Attached Files
    Last edited by AliGW; 12-20-2019 at 03:13 AM.

  5. #5
    Registered User
    Join Date
    06-27-2005
    Posts
    8

    Re: Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    Quote Originally Posted by Fluff13 View Post
    Depending on your version of Xl (I think you need 2010 or newer) try.
    Select B2:G38 & use this formula
    =SUMPRODUCT(--(B2=Sheet2!$B$1:$F$52))
    Thank you so much. This solved it!
    I have more questions about some other things Im wanting to do with this same file. Is it ok to ask in this thread or do I need to create a new one?
    Last edited by vinnievegas; 01-02-2020 at 01:43 PM. Reason: Added quoted text from solution.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    62,051

    Re: Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    Start a new thread for each separate issue with a suitably descriptive title.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" to anyone who has offered you help in your thread. You can reward them by clicking on * Add Reputation below theur user name on the left, if you wish.


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    12,402

    Re: Conditional Formatting using data in Sheet2 to change colors of cells in sheet1

    Thank you so much. This solved it!
    You're welcome & thanks for the feedback

+ 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. Replies: 0
    Last Post: 06-15-2017, 06:28 PM
  2. Macro to change colors of sheets data both sheet1 and sheet2 data same
    By toravietl in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-12-2017, 02:33 PM
  3. [SOLVED] Conditional formatting to change colors of Columns based on data entered in Column E
    By JJFletcher in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-13-2016, 01:27 PM
  4. [SOLVED] Conditional formatting if A1 in sheet1 is not = A1 in sheet2 applied to a range
    By Mattlawson in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-09-2015, 09:10 PM
  5. conditional data from Sheet1 populate Sheet2
    By skibumjim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2014, 03:00 PM
  6. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  7. [SOLVED] Copy colors / names from Sheet2 to Sheet1
    By Berna11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2013, 10:58 AM

Tags for this Thread

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