+ Reply to Thread
Results 1 to 4 of 4

Conditional formatting with an AND statement

  1. #1
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2016
    Posts
    193

    Conditional formatting with an AND statement

    Hello,

    I'm working on a template and I want the cells in the body of a table to highlight if both of the below parameters are met.

    the row label in column A = "Hello"
    the cell value > 10

    Right now I have the formula in the conditional formatting as =IF(AND($A$1="Hello",B1>10),TRUE,FALSE)

    If I copy the format down and change $A$1 to $A$2 and so on, I can then copy it across so it works for the rest of the sheet but I run into a problem if I need to add additional rows.

    Thanks again.

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Conditional formatting with an AND statement

    You don't need the IF in conditional formatting
    Conditional formatting is an IF by default already.
    You just need a function that returns TRUE or FALSE
    AND returns a TRUE or FALSE result by itself.

    So you can just do
    =AND($A$1="Hello",B1>10)


    And you don't have to put it in one cell, then copy it down and adjust the references each time.
    Instead, highlight the ENTIRE range you want it applied to
    And enter the formula relative to the top/left cell of the range you highlighted.
    You just need to make the Row Reference 'relative' instead of absolute (remove the $ from the Row)
    Change $A$1 to $A1

    =AND($A1="Hello",B1>10)


    Hope that helps.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Conditional formatting with an AND statement

    Hi,

    You don't need to copy and paste it. Just 'Apply' it to the rest of the range. And it's sufficient to use

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2016
    Posts
    193

    Re: Conditional formatting with an AND statement

    Thanks,

    I thought that I had tried that before but there must have been something else off with my formula. Works now.

    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. Conditional formatting with if statement
    By K120 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-25-2014, 02:39 PM
  2. Conditional Formatting (IF statement)
    By Marmie2 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-09-2013, 11:39 PM
  3. [SOLVED] If Statement within conditional formatting
    By galvinpaddy in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-07-2013, 04:27 AM
  4. 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
  5. Use if statement with conditional formatting?
    By q5 in forum Excel General
    Replies: 2
    Last Post: 08-24-2005, 11:05 PM

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