+ Reply to Thread
Results 1 to 12 of 12

IF statement for conditional formatting

  1. #1
    Registered User
    Join Date
    06-18-2019
    Location
    California
    MS-Off Ver
    2016
    Posts
    6

    IF statement for conditional formatting

    So I'm pretty new at this so I don't know if my formula is incorrect or if its something you just can't do with conditional formatting. In short I'm try to create a formula where if the value of two different cells drops below 1 another cell will turn yellow. The formula I'm using is:

    IF(AND(B2=0,OR(C2=0,D2=0)))

    Essentially if B2 is 0 and either C2 or D2 is 0 then A2 will turn yellow. so far I'm having no luck with this working. Any help will be greatly appreciative.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,445

    Re: IF statement for conditional formatting

    The If is implicit in conditional formatting
    try =AND(B2=0,OR(C2=0,D2=0))
    as CF after selecting the cell it is to be applied to

    If it is to be applied to a range, referencing would change

  3. #3
    Registered User
    Join Date
    06-18-2019
    Location
    California
    MS-Off Ver
    2016
    Posts
    6

    Re: IF statement for conditional formatting

    Pepe thanks for your response. I tried using the formula you shared and it still does nothing.

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,445

    Re: IF statement for conditional formatting

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    06-18-2019
    Location
    California
    MS-Off Ver
    2016
    Posts
    6

    Re: IF statement for conditional formatting

    Ok, so i attached the file I'm working on. Currently only have the formula for the first row, and it's the current one that you shared. just trying to do an inventory spreadsheat that will highlight the name of the tool when certain conditions are met so I know when to order more
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: IF statement for conditional formatting

    There was no conditional formatting rules defined in your uploaded file.

    Select A2:A29
    On the ribbon: Home > Conditional Formatting > New Rule > Use a formula
    Enter Pepe's formula:
    AND(B2=0,OR(C2=0,D2=0))
    Format with yellow fill

    I have attached your file with the above mods.
    Attached Files Attached Files
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  7. #7
    Registered User
    Join Date
    06-18-2019
    Location
    California
    MS-Off Ver
    2016
    Posts
    6

    Re: IF statement for conditional formatting

    Not sure why it didn't have the formula. I added the formula and saved it. That's wierd. Anyways I downloaded the file you uploaded and its working just fine. Not sure what was going on with my file. Thank you very much for the help

  8. #8
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: IF statement for conditional formatting

    No problem - glad it's working for you now - thanks for the feedback.

  9. #9
    Registered User
    Join Date
    06-18-2019
    Location
    California
    MS-Off Ver
    2016
    Posts
    6

    Re: IF statement for conditional formatting

    Ok guys, I'm back. So I took the file that Geoff made and I've added a bit more too it. However, one thing I have noticed with that formula is that regardless C2 or D2, as long as B2=0 it will always change the yellow. I've tried looking at articles online and changing things up but it never seems to function the way I want so I'm coming here again for help. What I'm trying to do is have the formula check to see if C2 or D2 is 0 then if so check to see if B2 is 0. If both those conditions are met then the other cell (A2) would change yellow. As it stands for some reason it doesn't care about C2 or D2 even though those values are listed in the formula. So right now I'm kind of at a loss. Currently I I'm using the formula that Pepe wrote.
    Attached Files Attached Files

  10. #10
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,445

    Re: IF statement for conditional formatting

    And which cells should the CF apply to?

  11. #11
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: IF statement for conditional formatting

    @vanillagorilla: There's no Condtional Formatting on the sheet.

    You've said you want to apply a condtional format to A2
    if B2 is 0 and either C2 is 0 or D2 is 0

    so

    Select A2

    Conditional Formatting
    New Rule
    Use a formula to determine...

    =AND(B2=0,OR(C2=0,D2=0))

    format as yellow

    This works.
    If this is not what you want then you need to explain more clearly.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  12. #12
    Registered User
    Join Date
    06-18-2019
    Location
    California
    MS-Off Ver
    2016
    Posts
    6

    Re: IF statement for conditional formatting

    Ok so before I work on why something isnt working I need to figure out why when I save my file the conditional formatting isn't saving.

    UPDATE: So I'm not sure of what was causing the formula to not work correctly and I'm also not sure why my CF was not saving. However, I started from scratch and just copied the text over and everything seems to be working fine now. Thanks to everyone to helped me get this working
    Last edited by vanillagorilla; 06-19-2019 at 10:55 AM.

+ 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 or IF statement help
    By RBburn in forum Excel General
    Replies: 5
    Last Post: 03-01-2018, 03:30 PM
  2. Conditional Formatting with IF statement
    By Arpita_Excel in forum Excel General
    Replies: 2
    Last Post: 06-23-2015, 03:07 AM
  3. [SOLVED] [CONDITIONAL FORMATTING] - IF statement
    By forfiett in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-27-2014, 01:34 PM
  4. [SOLVED] Conditional formatting with an AND statement
    By trisoldee in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2014, 02:23 PM
  5. IF statement for Conditional Formatting
    By ehines91 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 01-22-2013, 12:34 AM
  6. IF statement using formatting criteria (NOT conditional formatting)
    By chelseasikoebs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2009, 01:57 AM
  7. [SOLVED] If Statement/Conditional Formatting
    By JS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-29-2006, 11:55 AM

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