+ Reply to Thread
Results 1 to 20 of 20

Conditional Formatting - Highlight Cells

  1. #1
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Conditional Formatting - Highlight Cells

    Hello. I need help with a conditional formatting formula. I have a 6000 plus row spreadsheet and I would like conditional formatting to highlight cells in one column based on criteria from two other columns. I want to highlight cells in column D if cells in column C begin with the letter B and end with the letter I, but ONLY if the cells in column B are identical.

    snip1.JPG

    I hope the attachment showing the scenario shows up.

    Thank you.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,292

    Re: Conditional Formatting - Highlight Cells

    What you do in this situation? (also, always better to attach your file instead of an image)

    A B C D
    1 dwg term unit quantity
    2 4 a9 ab123 56
    3 4 a9 b123i 789
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Conditional Formatting - Highlight Cells

    Try

    =AND(LEFT(C2)="b",RIGHT(C2)="i",COUNTIF($C$2:$C$1000,$C2)>1)

  4. #4
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    Thank you for the quick reply. In that situation nothing would be highlighted because there is only one "unit" in column C that begins with b and ends with i. I guess I should have made that part more clear.

    Thank you.

  5. #5
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    Thank you JohnTopley. I used that formula in conditional formatting "use a formula to determine which cells to format" and used a fill color... The only cell that filled was A11 (as the image shows).
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Conditional Formatting - Highlight Cells

    Try applying (copy) my formula to D2 as it is D you want highlighted.

    Set applies to: $d$2:$d$1000
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    Thanks again JohnTopley. I see where I made the mistake of assigning the condition to all the cells. I then went back and only applied the condition to cells in column D. I came up with the same result as your attached file, however, I discovered that the formula found the duplicate "unit" in column C. It's the duplicate in column B that it should be finding. When I changed to ($B$2:$B$1000,$B2) it highlighted the cells that I originally expected and also cell D9 that I was not expecting.

    Any thoughts?

    Thank you.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Conditional Formatting - Highlight Cells

    I misread your original post: So we are looking for duplicates in B where corresponding cells in C start with B and end in I BUT C are not (necessarily) duplicates.

    I'll have to think how we might do this: it's late UK time so I will look tomorrow. Someone else might come up with a solution.

  9. #9
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    Correct JohnTopley. In fact, there definitely will be duplicates in Col C that the formula should ignore. It's only col B duplicates.

    I understand that it's getting late. I will check in on the thread tomorrow.

    Thank you for all your help!

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Conditional Formatting - Highlight Cells

    With a helper column in E

    =IF(AND(LEFT(C2)="b",RIGHT(C2)="I"),B2&LEFT(C2)&RIGHT(C2),"")

    CF formula

    =AND(E2<>"",COUNTIF($E$2:$E$14,E2)>1)
    Attached Files Attached Files

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting - Highlight Cells

    This seems to work...

    Select the range D2:D14

    Conditional Formatting

    Formula:

    =AND(LEFT(C2)="B",RIGHT(C2)="I",SUMPRODUCT(--(B$2:B$14=B2),--(LEFT(C$2:C$14)="B"),--(RIGHT(C$2:C$14)="I"))>1)

    Data Range
    A
    B
    C
    D
    1
    dwg
    term
    unit
    qty
    2
    1
    a1
    ww123
    500
    3
    1
    a2
    b123i
    400
    4
    2
    a3
    b345i
    100
    5
    2
    a4
    hh654
    50
    6
    2
    a4
    b987i
    78
    7
    2
    a4
    b897i
    458
    8
    2
    a5
    jj432
    658
    9
    2
    a5
    b567i
    52
    10
    3
    a6
    kk345
    658
    11
    3
    a7
    ll234
    214
    12
    3
    a8
    b234i
    235
    13
    3
    a8
    gg234
    54
    14
    3
    a8
    b234i
    66
    15
    ------
    ------
    ------
    ------
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Conditional Formatting - Highlight Cells

    @Tony

    ... never would have thought of using SUMPRODUCT as a way of "combining" the tests.

    So much for me being an "expert" !!!

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting - Highlight Cells

    Excel "Expert" (or "Guru" for that matter) is a misnomer!

    Excel is a never ending learning process.

  14. #14
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,211

    Re: Conditional Formatting - Highlight Cells

    Try this formula for CF:

    =COUNTIF(C2,"b*I")*COUNTIFS($B$2:$B$14,B2,$C$2:$C$14,C2)>1
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    A big thank you to all of you who contributed to solving my Conditional Formatting needs. Thank you Tony Valko for the formula!

    telcocook

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting - Highlight Cells

    You're welcome. We appreciate the feedback!

  17. #17
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    I discovered a small issue when I put this CF into practical application. Not only does column B need to have the same data to trigger it, so does column A. An example would be if there was only one "unit" with BxxxxI on "dwg" 74 which has a "term" a4, the current formula created by Tony would highlight the "qty" on that row as well (which it should not).

    Something I overlooked in the beginning. Sorry.

    Any further help would be greatly appreciated.

    Thank You.

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting - Highlight Cells

    Maybe this...

    =AND(LEFT(C2)="B",RIGHT(C2)="I",SUMPRODUCT(--(A$2:A$14=A2),--(B$2:B$14=B2),--(LEFT(C$2:C$14)="B"),--(RIGHT(C$2:C$14)="I"))>1)

  19. #19
    Registered User
    Join Date
    09-10-2014
    Location
    Lexington, KY
    MS-Off Ver
    2021
    Posts
    45

    Re: Conditional Formatting - Highlight Cells

    Thanks again for the quick reply Tony. I'm getting ready to go into a meeting. I will check it out in about an hour and let you know.

    Thank you.

  20. #20
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,211

    Re: Conditional Formatting - Highlight Cells

    Or trry this ...
    =COUNTIF(C2,"b*I")*COUNTIFS($A$2:$A$14,A2,$B$2:$B$14,B2)>1

+ 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. Conditional Formatting to highlight cells help!
    By excelnoob7 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-17-2015, 04:19 PM
  2. Conditional Formatting - Highlight Cells More Than 8 Hours
    By KITTYPXX in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-12-2013, 05:53 AM
  3. Replies: 5
    Last Post: 05-18-2013, 07:49 PM
  4. Highlight blank cells using conditional formatting.
    By weddings in forum Excel General
    Replies: 4
    Last Post: 06-09-2012, 05:57 PM
  5. Conditional Formatting - Highlight Cells
    By jfs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2011, 01:14 PM
  6. Highlight cells with VBA or Conditional Formatting?
    By starcraftbud in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2010, 03:54 PM
  7. Conditional Formatting to highlight protected cells
    By lostinformulas in forum Excel General
    Replies: 1
    Last Post: 02-16-2009, 02:52 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