+ Reply to Thread
Results 1 to 20 of 20

Color the columns based on group and column value

  1. #1
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Color the columns based on group and column value

    I am using excel 2016, where I need to do some coloring based on group and a value in a particular column.

    My input record is given below

    COLA COLB COLC COLD COLE COLF COLG COLH COLI
    100 45.6 MP 1 AA DD xxxx xxxx xxxx
    100 44.7 DA 1 DE DD xxxx xxxx xxxx
    100 43.4 CP 1 DFFF DFFF xxxx xxxx xxxx
    121 33.45 MP 1 AA DD xxxx xxxx xxxx
    121 33.45 DA 1 DE DD xxxx xxxx xxxx
    121 33.45 DA 1 DFFF DFFF xxxx xxxx xxxx
    234 23.54 MP 2 DE DD xxxx xxxx xxxx
    234 12.34 CP 2 DFFF DFFF xxxx xxxx xxxx

    My expected output is that I need to put the color the rows with COLA values 100 and 234, as this row group contain value "CP" in COLC
    Attached Files Attached Files
    Last edited by geoisaac; 05-14-2019 at 11:06 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,443

    Re: Color the columns based on group and column value

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    I did edit my post and uploaded two sheets, before and after

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    Select the entire range to highlight

    Conditional Formatting
    New Rule
    Use a formula to determine...

    =AND(OR(A2=100,A2=234)*COUNTIF(C$2:C$11,"CP")>0)

    format as required
    Last edited by Special-K; 05-14-2019 at 10:12 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    Hi Special-k, its not necessary that the values is COLA and is always the same. It can be of any values. Given is just a sample data. I have around 400 thousand records with different values

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    You need to be a little more specific, my solution reflects the file you provided.
    Maybe provide some more examples?

  7. #7
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    Hi, sorry for that. Yea basically what I want is that, within a group(grouping is done based on COLA and COLD), if I have any row with value "CP", then I need to highlit all the rows in that group. And the given set is a sample set. I have attached after sheet with more records. Again the value in COL A is not static as given in the sheet. So grouping by passing the value will not work

  8. #8
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    Try this CF formula

    =MATCH(A2,IF(C$2:C$11="CP",A$2:A$11),0)>0

  9. #9
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    I am not sure whether I did something wrong. I am selecting the complete set of records, then going to conditional formatting and select new rule.Then selecting the option "use a formula to determine which cells to format". After that I am giving the formula "MATCH(A2,IF(C$2:C$11="CP",A$2:A$11),0)>0", I am not giving = before that command as it will not accept that. After that I am clicking on format and filling a color and click on ok. But nothing changed

  10. #10
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    Just paste the below formula into the "format values where this formula is true" box, it does accept =

    The formula was wrong, it only highlighted column A.
    It should be

    =MATCH($A2,IF($C$2:$C$11="CP",$A$2:$A$11),0)>0

  11. #11
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    Just paste the below formula into the "format values where this formula is true" box, it does accept =

    The formula was wrong, it only highlighted column A.
    It should be

    =MATCH($A2,IF($C$2:$C$11="CP",$A$2:$A$11),0) > 0

  12. #12
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    I am still facing some issue, I have attached the error below
    Attached Images Attached Images
    Last edited by geoisaac; 05-14-2019 at 11:08 AM.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,443

    Re: Color the columns based on group and column value

    Don't mess about with the OP. It just gets confusing.

  14. #14
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    Sorry I just remove it. But I am not sure how to attach this error message while replying. I found it

  15. #15
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    Here you go
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    Thanks a lot :-) Its working with my sample data and I have applied this to my original data which is having around 400 thousand record, so I modified the formula as below

    =MATCH($A2;IF($C$2:$C$442065="CP";$A$2:$A$442065);0) > 0

    Still excel is trying to apply formula, but I will wait for sometime and will let you know the result.

  17. #17
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    Looks like its not working when I tried to apply for a larger set. still its processing and got stuck

  18. #18
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    If it works on a smaller set of data then it sounds like the larger data needs looking at.

  19. #19
    Registered User
    Join Date
    05-14-2019
    Location
    Sweden
    MS-Off Ver
    2016
    Posts
    10

    Re: Color the columns based on group and column value

    Finally I tried for 1000 records and notice that its not working properly. Its filling the color, but not for all the rows that met this condition. Its filing some set of rows which met this condition.

    =MATCH($A2;IF($C$2:$C$1000="CP";$A$2:$A$1000);0) > 0

  20. #20
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Color the columns based on group and column value

    Post a sample of the data where it's not working (in a file so the data can be examined).

+ 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. Sum other columns based on color in other column
    By civil8 in forum Excel General
    Replies: 0
    Last Post: 08-27-2018, 12:36 AM
  2. [SOLVED] Trying to group graph bars by color based on month
    By aejerome in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 03-19-2018, 11:43 AM
  3. Group value in columns with header based on value in another column
    By hitarov in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-02-2013, 03:44 AM
  4. Group based on cell content or color
    By Shaner73 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2012, 04:35 PM
  5. BG color every other group based on criteria
    By cfluegel in forum Excel General
    Replies: 6
    Last Post: 11-01-2010, 12:24 PM
  6. Replies: 6
    Last Post: 03-07-2010, 02:13 PM
  7. Hiding a group of columns based on another column
    By fasterthanyours in forum Excel General
    Replies: 1
    Last Post: 01-13-2010, 04:17 PM

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