+ Reply to Thread
Results 1 to 8 of 8

Conditional formatting with AND and OR in same formula

  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    Bozeman, MT
    MS-Off Ver
    Excel 2010
    Posts
    10

    Conditional formatting with AND and OR in same formula

    For a report I run where I am looking for missing/inaccurate information entered into our database, I have a column that has “Decision”. There are two additional columns that affect whether or not there should be a date in this column. If the text in the cell of the specific row under the "Method" column is either “Paper” or “Online” AND if the text in the cell of the same row under the "Status" column is either “Approved” or “Active” AND the date in the cell of the same row under the "Decision" column is blank, the cell should be highlighted. I think the formula needs to be something like this: if (column A has either “Paper” OR “Online”) AND (if column B has either “Approved” or “Active” status) AND (if column C is blank), then it highlights the cell.

    I tried this and it’s not working:

    =AND(OR($AB2="Paper Contracting",$AB2="Online Contracting"),OR($S2="Approved",$S2="Active with Application"),$V2="")

    Please help!

  2. #2
    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
    53,044

    Re: Conditional formatting with AND and OR in same formula

    I cannot see anything glaringly wrong with that formula...
    =AND(
    ...OR($AB2="Paper Contracting",$AB2="Online Contracting"),
    ...OR($S2="Approved",$S2="Active with Application"),
    ...$V2="")

    Are you sure that the criteria spelling is eh same as used on the table? check for leading/trailing spaces
    Is the date column really empty/blank, and doesnt contain a formula or something?
    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

  3. #3
    Registered User
    Join Date
    12-04-2013
    Location
    Bozeman, MT
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Conditional formatting with AND and OR in same formula

    I checked the columns and text and it is correct (didn't give whole text in my paragraph). I don't have anything highlighted b/c the data is correct, but when I change the status from "Pending" to "Approved" in a row where the contracting method is "Paper Contracting", and the Decision from Carrier is blank, it doesn't highlight the field. I've tried it also where the status is Approved, but the method was not "Paper Contracting" or "Online Contracting" and it's not highlighting the cell in that case either.

  4. #4
    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,676

    Re: Conditional formatting with AND and OR in same formula

    Try

    =AND(OR($AB2="Paper Contracting",$AB2="Online Contracting"),OR($S2="Approved",$S2="Active with Application"),NOT(ISNUMBER($V2)))

    You will get an invalid result if V2 is space rather than null.

    If V2 was null (i.e., if I "Clear Contents") then formula works OK.

  5. #5
    Registered User
    Join Date
    12-04-2013
    Location
    Bozeman, MT
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Conditional formatting with AND and OR in same formula

    hmm, not able to get that to work. In one row, I have "Pending" for the status in column S, "Paper Contracting" for the method in column AB and the decision field is blank. When I change the "Pending" to "Approved", it doesn't highlight the cell even though it should since the appointment is approved and it was Paper Contracting. Make sense?

  6. #6
    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,676

    Re: Conditional formatting with AND and OR in same formula

    I have just repeated your test and it works OK for me. I tried various combinations before posting my formula and all worked.

    Put the formula in a cell and check the TRUE/FALSE conditions that result when you change the various parameters.

    I suggest you post a sample file and I'll look at ASAP tomorrow but logging off now as it late here in the UK.

  7. #7
    Registered User
    Join Date
    12-04-2013
    Location
    Bozeman, MT
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Conditional formatting with AND and OR in same formula

    That worked! Not sure what was going wrong, but did what you said and it worked. Thanks so much!

  8. #8
    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,676

    Re: Conditional formatting with AND and OR in same formula

    Good news and thank you for the feedback.

+ 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. Replies: 3
    Last Post: 06-19-2015, 07:16 AM
  2. Formatting Cells with Date or Text Values in a Conditional Formatting Formula
    By Phil Hageman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-15-2014, 09:36 AM
  3. Opening xlsm files with conditional formatting opens with removed conditional formatting
    By Martijn.Steenbakker in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-07-2014, 05:38 AM
  4. If Formula - conditional formatting - three different formatting rules
    By sharper1989 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-25-2014, 04:49 PM
  5. Replies: 3
    Last Post: 11-28-2013, 02:11 AM
  6. Replies: 1
    Last Post: 07-19-2012, 05:37 AM
  7. [SOLVED] How do I do a complex conditional in a conditional formatting formula
    By Ray Stevens in forum Excel General
    Replies: 6
    Last Post: 03-12-2006, 06:30 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