+ Reply to Thread
Results 1 to 11 of 11

Dynamically color cell on Summary sheet based on column values on data sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Dynamically color cell on Summary sheet based on column values on data sheet

    Hello all,
    I have attached an example to review. What currently happens is when the Process button is pressed on the 2_Summary sheet, the code takes data from the 1_ImportedData sheet, creates a new sheet for each customer, and populates the sheet with the customer's data. Then a link to the customer sheet is placed on the 2_Summary sheet. I need the cell on the 2_Summary sheet with the link to be colored based on some data counts on the customer sheet. On the customer sheet, I am looking for various values and if the value matches a specified number, the linked cell automatically changes to the desired color.

    Thanks,
    Andrew
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    First of all, alter the code so that the name shown on the link matches the name of the tab created.

    Then use conditional formatting as shown in the pictures.
    Attached Images Attached Images

  3. #3
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    Thanks dflak. The names on the tabs and the links on the 2_Summary sheet are created dynamically and this will be done every time after the tab has been created. I will try the conditional formatting and formulas indicated.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    One of the ways to apply conditional formatting automatically to newly-generated data is to put that data into an Excel table. Tables automatically copy down formatting, conditional formatting, formulas, validations, etc. as lines are added to the table.

    Here is some information on working with Excel Tables: http://www.utteraccess.com/wiki/inde...ables_in_Excel

  5. #5
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    I changed the link names to match the tab names. I am trying to create the conditional formatting on 2_Summary cell A4 and am getting an error using what looks like the formula in the screenshot.

    =indirect("'"&A4&"'!E1")=indirect("'"&A4"'!E2")
    I am not sure what the indirects are referring to since the data is on another sheet and I don't see the sheet referenced. Additionally, can the conditional formatting be placed in each new linked name when it is created on the 2_Summary sheet?

    I attached a slightly modified spreadsheet with the headers in the correct places and colors we need to compare with. I did not do it for the example, but I have conditional formatting for each type of item that shows red, yellow, green based on the count for that item. if any item is red, the 2_Summary link needs to be red. If any are yellow or green, the 2_Summary link needs to be yellow, if all are green, the link needs to be green.

    EDIT...the trick is that each customer will have different required quantities of the items so each sheet is basically tailored to that customer, that is why I am trying to base the 2_Summary link color off the colors of the items instead of the values.

    Thanks!
    Attached Files Attached Files
    Last edited by drewship; 01-08-2016 at 10:58 AM.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    What INDIRECT does is take what it sees inside the parenthesis and interprets it as a range. So if Cell A4 contains the string "Jim" then '"&A4&"'!E1" becomes 'Jim'!E1. INDIRECT("'Jim'!E1") is the same as typing ='Jim'!E1. It is a way of dynamically building the range name for where you want to look.

    I did not see any conditional formatting applied in the new sheets.

  7. #7
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    Ok, I added in conditional formatting to some of the sheets. This gives me the initial colors I need to check before coloring the 2_Summary link.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    Ok. I added a conditional formatting to cell A4 on 2_Summary with the following formula:

    =indirect("'2_Summary'"&A4&"'Andy_Palmer'!$D$2")=indirect("'2_Summary'"&A4&"'Andy_Palmer'!$D$3")
    If I follow this correctly, it will compare the value of Andy_Palmer cell D2 to Andy_Palmer cell D3 and turn cell A4 on 2_Summary green (because both cells contain a 3...but it is not working. I get no errors but A4 is not changing color.
    Attached Files Attached Files

  9. #9
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    You are almost correct in your interpretation, but: you do not need to include the "2_Summary" part nor do you have to include the Andy_Palmer part. The best way to work with indirect is to develop the string you want to interpret first and then copy and paste into the formula where you need it.

    The correct formula is =INDIRECT("'"&A4&"'!$D$2")=INDIRECT("'"&A4&"'!$D$3") and this should be applied to Cells A4:A7.

  10. #10
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    Your formula works of course...and now I think I see where I was getting confused. I wanted to specify each tab because I did not see how this was done in the formula. Since A4 contains the name of the tab, it is used locally to set the value to be used and the ! is used to specify the tab of the same name with the $D$2 and $D$3 being compared on the tab instead of the 2_Summary sheet. Did I explain this correctly? This is a cool method of creating the conditional formatting dynamically!!

  11. #11
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Dynamically color cell on Summary sheet based on column values on data sheet

    Since this only works with values and not colors, I can probably create a helper column with code that counts colors on the customer tab and use the conditional formatting to update the summary tab based on the number of total red, yellow, green counted.

+ 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: 04-26-2015, 07:41 AM
  2. Dynamically Show the Summary Sheet Cells Based on Other Sheets
    By Kandavalli.Kiran in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-07-2015, 03:01 AM
  3. [SOLVED] Populate summary sheet with values within specific month column on data sheet...
    By blue91 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-12-2013, 12:11 PM
  4. search cell values based on list of values in other sheet and add color to row
    By darkbraids in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2012, 08:35 AM
  5. Select data in Sheet 2 based on column values in Sheet 1
    By Snehith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2011, 08:52 PM
  6. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2006, 08:33 AM
  7. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 10:33 AM

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