+ Reply to Thread
Results 1 to 31 of 31

How to use conditional formatting only on filled cells?

  1. #1
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    How to use conditional formatting only on filled cells?

    Hi all,

    Hope all are well.

    In attached sheet, i am using CF in column G such that if cells under column G doesn't start with below options, then highlight in red.

    DM_ATTP_GSK
    DM_ATTP_CMO
    DM_ATTP_CUST
    DM_ATTP_VX


    I used below formula but the issue is that even blank cells are highlighted in red.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Can someone please help
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    10-17-2007
    Location
    Tasmania, Australia
    MS-Off Ver
    2019, 365(v2403)
    Posts
    367

    Re: How to use conditional formatting only on filled cells?

    try this instead
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    @russkris

    Thanks for your response.

    Tried but now it highlights few cells and not others. Attached file.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Just an update - Cells should be considered from G4

  5. #5
    Valued Forum Contributor
    Join Date
    10-17-2007
    Location
    Tasmania, Australia
    MS-Off Ver
    2019, 365(v2403)
    Posts
    367

    Re: How to use conditional formatting only on filled cells?

    Please Login or Register  to view this content.
    DM_ATTP_CUST wasnt included. sorry
    Attached Files Attached Files

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,959

    Re: How to use conditional formatting only on filled cells?

    To start with, dont use full column references with CF, it can slow your file down. Use 2-3 times the range that you think you might need...I used =$G$4:$G$500. (this will stop the headings from being tested)

    Try this instead for the 1st C ryule...
    =AND(ISTEXT(G4),OR(LEFT(G4,12)<>"DM_ATTP_GSK",LEFT(G4,12)<>"DM_ATTP_CMO",LEFT(G4,12)<>"DM_ATTP_CUST",LEFT(G4,12)<>"DM_ATTP_VX"))

    (russkriss in your suggestion, you reference G1 instead of G4 in 2 of your conditions. Also, CF only needs a TRUE or FALSE answer, you can do away with the IF statement)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    @FDibbins

    Many thanks for your response and suggestion on not using full column references with CF.

    Its working now.

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,662

    Re: How to use conditional formatting only on filled cells?

    Workbook has code running in a password protected vba project
    Ben Van Johnson

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,959

    Re: How to use conditional formatting only on filled cells?

    Happy to help and thanks for the feedback

  10. #10
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Quote Originally Posted by protonLeah View Post
    Workbook has code running in a password protected vba project
    Since formula was required for CF, i didnt unprotect the VBA. My apologies.

  11. #11
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Sorry but 1 help

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Can 1 more condition be added in above formula such that the cells should be highlighted if date in column E is on or after 01-03-2024

    To elaborate, if date in column E is on or after 01-03-2024 and column G doesn't start with below options, then highlight cell in red.

    DM_ATTP_GSK
    DM_ATTP_CMO
    DM_ATTP_CUST
    DM_ATTP_VX

    Thanks in advance.

  12. #12
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    Do you mean 01-03-2024 as a hard date or a TODAY() date?

    Tip:
    Don't use the conditional format for the entire column. As you have a named table use the formatting there and as you add new data the CF will follow.
    The same for the rows border, you don't need to format it in advance, the table will take care of it as you add new data.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    01-03-2024 will be constant

    May i know how to use CF and borders for a named table?

  14. #14
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    You just use the CF inside of the body area of the named table (not the header) and as it expand it will carry it.
    I did it for you, BUT you have more then 20 CF rules, probably many of them are contradicting each other, so before implementing any new rule better decide which one will continue there or not!
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Many thanks for the suggestion on CF. I'll follow it.

    Also thanks for modifying the below formula but it doesn't seem to work. Although date in column E is before 1st March, the cell is highlighted in red

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  16. #16
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    This might be because of your other CF that are contradictory. Did you erase all other to test?

  17. #17
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Yes i tried. It seems the issue is with format. Its turning red on and after 03 Jan 2024 instead of 1st March 2024.

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,624

    Re: How to use conditional formatting only on filled cells?

    Here's why:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    E
    F
    G
    1
    45294
    =
    03/01/2024
    2
    45352
    =
    01/03/2024
    Sheet: Sheet1

    =AND(ISTEXT(G7),OR(LEFT(G7,12)<>"DM_ATTP_GSK",LEFT(G7,12)<>"DM_ATTP_CMO",LEFT(G7,12)<>"DM_ATTP_CUST",LEFT(G7,12)<>"DM_ATTP_VX"),E7>=45294)

    Try:

    =AND(ISTEXT(G7),OR(LEFT(G7,12)<>"DM_ATTP_GSK",LEFT(G7,12)<>"DM_ATTP_CMO",LEFT(G7,12)<>"DM_ATTP_CUST",LEFT(G7,12)<>"DM_ATTP_VX"),E7>=45352)
    Ali


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

    Forum Rules (updated August 2023): please read them here.

  19. #19
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    I inherited a wrong formula...

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    LEFT(G7,11)<>"DM_ATTP_GSK",
    LEFT(G7,11)<>"DM_ATTP_CMO",
    LEFT(G7,12)<>"DM_ATTP_CUST",
    LEFT(G7,10)<>"DM_ATTP_VX"

  20. #20
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Quote Originally Posted by AliGW View Post

    Try:

    =AND(ISTEXT(G7),OR(LEFT(G7,12)<>"DM_ATTP_GSK",LEFT(G7,12)<>"DM_ATTP_CMO",LEFT(G7,12)<>"DM_ATTP_CUST",LEFT(G7,12)<>"DM_ATTP_VX"),E7>=45352)

    Thanks AliGW, but still same issue.

  21. #21
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    Eventually the formula bellow could be a good alternative since you would use LEFT() less times.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  22. #22
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Quote Originally Posted by DJunqueira View Post
    I inherited a wrong formula...

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    LEFT(G7,11)<>"DM_ATTP_GSK",
    LEFT(G7,11)<>"DM_ATTP_CMO",
    LEFT(G7,12)<>"DM_ATTP_CUST",
    LEFT(G7,10)<>"DM_ATTP_VX"
    Thanks for the correction. Date still remains the issue.

  23. #23
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Quote Originally Posted by rizwanulhasan View Post
    Thanks AliGW, but still same issue.
    My apologies. It works

  24. #24
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,624

    Re: How to use conditional formatting only on filled cells?

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, remember that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  25. #25
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Another issue now.

    Although cell G4 starts with DM_ATTP_GSK, yet its highlighted in red.

    Just to clarify that below is th requirement

    If date in column E is on or after 01-03-2024 (1st March 2024) and column G doesn't start with below options, then highlight cell in red.

    DM_ATTP_GSK
    DM_ATTP_CMO
    DM_ATTP_CUST
    DM_ATTP_VX
    Attached Files Attached Files

  26. #26
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    The date sample you gave us didn't fall in the range of that date.

    As a final formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  27. #27
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Quote Originally Posted by DJunqueira View Post
    The date sample you gave us didn't fall in the range of that date.

    As a final formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Same issue. Although cell G4 starts with DM_ATTP_GSK, yet its highlighted in red.

  28. #28
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    New test.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  29. #29
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    783

    Re: How to use conditional formatting only on filled cells?

    Quote Originally Posted by DJunqueira View Post
    New test.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Perfect. Thank you so much

  30. #30
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,624

    Re: How to use conditional formatting only on filled cells?

    Thanks for the rep.

  31. #31
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: How to use conditional formatting only on filled cells?

    Tks for the feedback, glad to help.

+ 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. [SOLVED] Conditional formatting is out of tolerance and filled in red font
    By metrostar in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-20-2022, 09:05 PM
  2. Replies: 3
    Last Post: 03-28-2019, 03:30 PM
  3. Replies: 1
    Last Post: 03-21-2019, 05:26 PM
  4. [SOLVED] Conditional Formatting for cells that need to be filled out
    By rhett7660 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-06-2017, 01:30 PM
  5. Conditional Formatting - highlighting until values are filled in
    By HStollery in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-20-2016, 11:43 PM
  6. cell conditional formatting to change when certain cells are filled
    By mordy88 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-25-2015, 10:22 PM
  7. Replies: 5
    Last Post: 05-08-2015, 12:08 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