+ Reply to Thread
Results 1 to 8 of 8

Conditional formatting + IF + AND error

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2024
    Location
    Mariehamn, Aaland Islands
    MS-Off Ver
    O365 for Mac
    Posts
    5

    Lightbulb Conditional formatting + IF + AND error

    Hi,

    I have been trying to format my table to highlight rows if TWO conditions are met
    1. A checkbox in a cell is TRUE (checked)
    2. A cell in the table contains a partial text string (the string is present in another cell)

    The conditional formatting formula is as follows and it works if I only reference to the string in the cell BUT if I add a wildcard in the formula "*" it does not work

    The formula that works is:
    =IF(AND($F$1=TRUE;$E6=$E$1);TRUE;FALSE)

    The formula that does not work is:
    =IF(AND($F$1=TRUE;$E6="*"&$E$1&"*");TRUE;FALSE)

    F1 contains the "new" checkbox
    $E6 (cell/column) contains names with separation commas (can be multiple names and I want to highlight a row if the name from cell E1 is found in the cell/column $E6)

    Any hints to what can be wrong?
    Attached Files Attached Files
    Last edited by dominicusb; 09-05-2024 at 11:33 AM.

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

    Re: Conditional formatting + IF + AND error

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  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
    30,820

    Re: Conditional formatting + IF + AND error

    Try

    for CF

    Formula: copy to clipboard
    =AND($F$1=TRUE,ISNUMBER(SEARCH(E$1,$E6)))
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Registered User
    Join Date
    09-05-2024
    Location
    Mariehamn, Aaland Islands
    MS-Off Ver
    O365 for Mac
    Posts
    5

    Re: Conditional formatting + IF + AND error

    suggestion: =AND($F$1=TRUE,ISNUMBER(SEARCH(E$1,$E6)))

    It did not work. It highlighted random cells not rows consistently.
    At least I didn't get it to work by adding it to the formula instead of the later AND statement

    This is what I changed:
    =IF(AND($F$1=TRUE;ISNUMBER(SEARCH(E$1;$E6)));TRUE;FALSE)
    Last edited by dominicusb; 09-05-2024 at 11:42 AM.

  5. #5
    Registered User
    Join Date
    09-05-2024
    Location
    Mariehamn, Aaland Islands
    MS-Off Ver
    O365 for Mac
    Posts
    5

    Re: Conditional formatting + IF + AND error

    Quote Originally Posted by dominicusb View Post
    suggestion: =AND($F$1=TRUE,ISNUMBER(SEARCH(E$1,$E6)))

    It did not work. It highlighted random cells not rows consistently.
    At least I didn't get it to work by adding it to the formula instead of the later AND statement

    This is what I changed:
    =IF(AND($F$1=TRUE;ISNUMBER(SEARCH(E$1;$E6)));TRUE;FALSE)


    NOW IT WORKS :-)
    I changed it to:
    =IF(AND($F$1=TRUE;ISNUMBER(SEARCH($E$1;$E6)));TRUE;FALSE)

  6. #6
    Registered User
    Join Date
    09-05-2024
    Location
    Mariehamn, Aaland Islands
    MS-Off Ver
    O365 for Mac
    Posts
    5

    Re: Conditional formatting + IF + AND error

    Thanks for your help JohnTopley

    :-)

  7. #7
    Registered User
    Join Date
    09-05-2024
    Location
    Mariehamn, Aaland Islands
    MS-Off Ver
    O365 for Mac
    Posts
    5

    Re: Conditional formatting + IF + AND error

    I added the excel file for clarification :-)
    Mind that the language is Swedish but the code is in English

    Thanks

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

    Re: Conditional formatting + IF + AND error

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward 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.

+ 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 error
    By sumesh56 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-16-2022, 10:42 PM
  2. [SOLVED] Conditional Formatting Error?
    By kellyfirth in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-12-2015, 10:10 AM
  3. [SOLVED] Conditional formatting UDF value error
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2015, 05:43 PM
  4. Conditional Formatting - Run Time Error '13' Type Mismatch Error
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2011, 07:37 PM
  5. [SOLVED] Conditional formatting error, odd!
    By bob in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2006, 01:45 PM
  6. [SOLVED] conditional formatting for Error
    By krupesh in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  7. [SOLVED] conditional formatting for Error
    By krupesh in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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