+ Reply to Thread
Results 1 to 25 of 25

Conditional Formatting Highlight Date that has Text

  1. #1
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Conditional Formatting Highlight Date that has Text

    Good Afternoon,

    In the attached spreadsheet, I want the conditional formatting to highlight any cell in column C if the date is prior to today.

    Things to notice:
    1-Some cells in column C have text with the date
    2-Some cells in column C have multiple dates
    3-If there is any text with the date, it will always be in the format of "date-text" and date doesn't have leading zeros for single digit months or days

    Any assistance in this matter is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    In my opinion, it's better to use VBA to solve the problem.
    Check my solution.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Best Regards,
    Maras.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Conditional Formatting Highlight Date that has Text

    With this:
    5/1/2021-test message 1; 10/15/2020-test message 2
    Is the date alway "month/date/year"?
    how many date-strings possible exist in text? 2 or more?
    Quang PT

  4. #4
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    I like it! Thank you. What would be the code I would add to the worksheet object if I wanted this macro run automatically when there is a selection change only in that column? I know to use "Private Sub Worksheet_SelectionChange(ByVal Target As Range)" but not sure how to create the rest of the code to run if there is a selection change only for that column.

  5. #5
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    Check.
    Put the following code in the 'Sheet1' module.
    Please Login or Register  to view this content.
    Insert this code into a normal VBA module.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    Yes, however date could be single digit month and single digit day and two digit year (ex. 1/1/20).

  7. #7
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    Clarification: I would make a change to the field in column C but would like the highlighting to update when I click outside that cell I just updated (outside cell could be in column C or any other column or row). Would you please update the code to reflect this? Thank you.
    Last edited by KolKon; 11-05-2020 at 12:20 PM.

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Conditional Formatting Highlight Date that has Text

    Please try CF formula

    =OR(FILTERXML("<x><m>"&SUBSTITUTE(SUBSTITUTE(C2,";","-"),"-","</m><m>")&"</m></x>","//m")<TODAY())
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    This is great! Thank you all for your help!

  10. #10
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    Maras,

    Did you happen to have a chance to review my latest message about the clarification on 11/5/2020 regarding clicking on a different cell? I appreciate your help.

  11. #11
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    If I understand you right, just change that
    Please Login or Register  to view this content.
    on
    Please Login or Register  to view this content.
    .

  12. #12
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    This is perfect! Thank you!

  13. #13
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    I need to make a change to this request. If there is any text with the date, it could be in any of the following formats:
    date-text
    OR
    date (text); date-text; date (text) etc...basically could be a parenthesis after the date instead of a dash

    Is it possible to allow for parenthesis in this formula?

    Thank you.
    Last edited by KolKon; 03-24-2021 at 02:15 PM.

  14. #14
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    What is your problem?
    Show in the attachment before and expected result.

  15. #15
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    Please see the attached workbook with examples. Thank you.
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    The problem is with the date format.
    In my Excel, dates are only in the format 'dd-mm-yyyy' and yours may be 'mm/dd/yyyy'.
    Check in the attachment.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    I see...Please let me know how to update the VBA for the following using the attached version 3 workbook:

    1-Change it to be based on column N (and what would I have to change in the future if I added more columns to the left)?
    2-Execute as soon as I update and click off cell in column N

    Thanks.
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    In the VBA module of the 'Sheet1'.
    Please Login or Register  to view this content.
    In a normal module of VBA.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    I'm sorry...I should have also specified I also want this to run when the workbook opens. In addition, the date format could be mm/dd/yy instead of mm/dd/yyyy. Would you please edit the VBA to accommodate both issues.

    Thank you.

  20. #20
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    I think this does what you want.
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    It's perfect...one last thing.
    I would like the font color to be white. I tried "If dt < Date Then c.Interior.Color = vbRed and c.font.color = vbWhite", but nope. I also tried moving the white to next line, but nope there too.

  22. #22
    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
    28,152

    Re: Conditional Formatting Highlight Date that has Text

    Then
    c.Interior.Color = vbRed
    c.font.color = vbWhite
    end if

  23. #23
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    Perfect! Thank you so much!

  24. #24
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Conditional Formatting Highlight Date that has Text

    I think it should be like that in the procedure 'Formating (c As Range)'.
    Please Login or Register  to view this content.

  25. #25
    Registered User
    Join Date
    10-17-2019
    Location
    Kentucky
    MS-Off Ver
    2019 Excel
    Posts
    33

    Re: Conditional Formatting Highlight Date that has Text

    This is great...thank you!

+ 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 to Highlight Cell if Delivery Date is Greater than the Due Date
    By rahul_ferns76 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-02-2019, 12:19 AM
  2. [SOLVED] Need Help on Conditional Formatting to highlight text
    By HaramiPollins in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-17-2017, 04:37 AM
  3. [SOLVED] Use Conditional Formatting to Highlight Date Due if Text in Another Cell
    By mrsdeapsleap in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-13-2015, 02:33 PM
  4. How to use conditional formatting to highlight date
    By SSS86 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2013, 03:47 PM
  5. Replies: 5
    Last Post: 08-22-2012, 05:06 PM
  6. Replies: 2
    Last Post: 02-21-2010, 05:53 PM
  7. conditional formatting To Highlight Row On Text
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-21-2009, 03:41 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