+ Reply to Thread
Results 1 to 13 of 13

conditional formatting and AND OR and INDIRECT functions

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Office 365
    Posts
    5

    conditional formatting and AND OR and INDIRECT functions

    Hello,

    Weird problem here... using office 365 latest version (from my company)

    I have a relatively complex formula that is not working (making references to other cells and additional calculus), but in order to find what is wrong, I have simplified the example:

    In cell B1 I have the numeric value 7.

    I create a conditional formatting just for this cell, using a formatting rule based on this formula (this one works ok): =INDIRECT(ADDRESS(ROW();COLUMN()))=7

    So the cell gets formatted as I want only if its value equals to 7 (working flawlessly)

    BUT, if instead this simple formula I use an AND or an OR formula, the cell does not get formatted (NEVER): =AND(INDIRECT(ADDRESS(ROW();COLUMN()))=7;TRUE)

    * I am using a TRUE for the second AND's condition but any expression like 1=1 or 1=2 or false, etc... becomes the same result: the cell never gets formatted.

    Conclusion: the combination of conditional formatting + AND/OR + INDIRECT makes it not working.

    Note alse that the AND + INDIRECT functions work well if you use them outside the conditional formatting.

    Thanks in advance,

    Obsy

  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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: conditional formatting and AND OR and INDIRECT functions

    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.

    Administrative Note:

    Is your forum profile up-to-date and showing ONLY the oldest Excel PRODUCT that you need this to work for?

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The three most recent Excel products are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.
    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
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,023

    Re: conditional formatting and AND OR and INDIRECT functions

    To start with, I am able to replicate the problem. The second formula works as a worksheet formula, but I do not know why it does not work as a conditional formatting rule.

    I suggest you give us the fully complicated version. Because I would use this conditional formatting formula in B1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    or even just use the "Format only cells that contain" rule instead of a formula. Using that INDIRECT formula is very convoluted. And the second one adding an AND is pointless.

    I think if you tell us what you are actually doing we can suggest a more comprehensive solution. However, in the meantime I will continue to see if I can find out what's going on with the formula you have presented.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: conditional formatting and AND OR and INDIRECT functions

    Are you really in England? If so, I wonder why you are using a European locale?

    =AND(INDIRECT(ADDRESS(ROW();COLUMN()))=7;TRUE)

    For a UK locale, the formula separators should be commas.

    Please update your profile as requested above and provide a sample workbook based on post #3.

  5. #5
    Registered User
    Join Date
    04-04-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Office 365
    Posts
    5

    Re: conditional formatting and AND OR and INDIRECT functions

    Hello,

    Thanks everybody for your great and quick answers.

    I am not able to post the xml (I am getting the error "You are not allowed to post any kinds of links, images or videos until you post a few times.", sorry for that.

    Anyway:

    As 6StringJazzer (cool alias!) said, using just =B1=7 instead of indirect works, thanks ! I will wait just in case you find what's going on with that INDIRECT 'devilish' function in this specific case...

    AliGW: I have just updated my profile and my Office version (365): I'm from Barcelona, spain. Thanks too !

    Regards,

    Obsy

  6. #6
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: conditional formatting and AND OR and INDIRECT functions

    You do not need to post any XML or any links.

    Read the yellow banner at the top of the page, which tells you how to attach your workbook using our attachments feature.

    Once you have provided a workbook, I'll take a look. Remember: we want to see this in its more complex form.

  7. #7
    Registered User
    Join Date
    04-04-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Office 365
    Posts
    5

    Re: conditional formatting and AND OR and INDIRECT functions

    I am sorry, my fault. I did not mean the "xml", but the "xlsx" I am a software developer and my mind is full of some other things sometimes.

    And yes, that message is what I am getting trying to post that Excel FILE following the yellow banner instructions.

  8. #8
    Registered User
    Join Date
    04-04-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Office 365
    Posts
    5

    Re: conditional formatting and AND OR and INDIRECT functions

    Here is the Excel file
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-04-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Office 365
    Posts
    5

    Re: conditional formatting and AND OR and INDIRECT functions

    As I suspected ! Once I wrote some more answers the forum allowed me to finally post that excel

  10. #10
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: conditional formatting and AND OR and INDIRECT functions

    Sorry, but you are wrong. You have always been able to post an attachment - there is not and never has been any restriction on this. However, you won't be able to post any links until you have made at least TEN posts. Something in the post (not the attachment) will have triggered the message.

    And yes, that message is what I am getting trying to post that Excel FILE following the yellow banner instructions.
    No, that message is NOT triggered when trying to attach a file - only if you are trying to include a link, or something that the forum software thinks is a link. You will find many examples of members whose first post includes an attachment. There is nothing different about your account.

    I shall have a look at the workbook now.
    Last edited by AliGW; 10-03-2024 at 09:13 AM. Reason: Additional information added.

  11. #11
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: conditional formatting and AND OR and INDIRECT functions

    OK, so this works:

    =AND(B1=7,1=1)

    You have not yet explained why you feel that the INDIRECT is necessary. We asked to see the wider picture, but you have not shared it.

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

    Re: conditional formatting and AND OR and INDIRECT functions

    Quote Originally Posted by AliGW View Post
    No, that message is NOT triggered when trying to attach a file
    I wonder if this occurs if you attach the file using a link, rather than an attachment icon. I have never done that myself but I see a lot members do it that way. I'll test that out.

    EDIT: No, that wasn't it. Even if you are not allowed to post links, you can post an attachment as an inline link.
    Last edited by 6StringJazzer; 10-03-2024 at 09:35 AM.

  13. #13
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,301

    Re: conditional formatting and AND OR and INDIRECT functions

    I think there was something in the body of the post OR the file's name that was triggering the message. It will not have been the file per se.

+ 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 for DV with INDIRECT.
    By Kenny_K in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-10-2024, 01:52 AM
  2. [SOLVED] Conditional formatting with OR and INDIRECT functions not working
    By Noah_Disseldorp in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-16-2023, 02:26 AM
  3. [SOLVED] Using conditional formatting with INDIRECT
    By okela in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-11-2021, 10:53 AM
  4. Conditional Formatting with Indirect
    By scott.garrett in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2017, 01:09 PM
  5. [SOLVED] Conditional Formatting with Indirect Function
    By nathanmccormick in forum Excel General
    Replies: 2
    Last Post: 07-08-2016, 04:38 PM
  6. Replies: 0
    Last Post: 11-14-2013, 10:37 AM
  7. Resolved >>> Conditional formatting with INDIRECT and AND
    By mike_something in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-22-2007, 07:54 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