+ Reply to Thread
Results 1 to 9 of 9

Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

  1. #1
    Registered User
    Join Date
    03-22-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2012
    Posts
    7

    Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Hello,

    Was directed to your site in my efforts to troubleshoot, but nothing has worked for me.

    I am trying to conditionally format (to highlight red with pink text) certain columns in an excel sheet based on two criteria being true: (1) that the row is odd, and (2) that the value of the cell is less than the value of the cell in the row above it (the even row).

    To do this, I put together the following formulas that work individually:

    =MOD(ROW(),2)>0

    For the row is odd condition

    =INDIRECT("A"&(ROW()-1))-INDIRECT("A"&(ROW()))>0

    For the condition that the cell be less than the cell above it.

    These both work individually, but when I try to combine them in order to make the condition contingent upon both being true it does not work; here is my end formula:

    =AND(MOD(ROW(),2)>0), (INDIRECT("A"&(ROW()-1))-INDIRECT("A"&(ROW()))>0)

    For some reason they aren't working in unison, and it is boggling my mind. I choose "Use a formula to determine which cells to format" and put in the formula under "format values where this formula is true:"

    What have I done wrong? is it because there are two inequality signs or what?

    Thanks in advance.

  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 Formula /w multiple criteria; formulas work indiv, not together

    Too many parens ()

    Try
    =AND(MOD(ROW(),2)>0,INDIRECT("A"&(ROW()-1))-INDIRECT("A"&(ROW()))>0)

  3. #3
    Registered User
    Join Date
    03-22-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2012
    Posts
    7

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Yeah I use that one, i copy and pasted a wrong formula i was working on

    I dont get an error, it just doesn't format like it should. I feel like there is something wrong with combining these two formulas

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

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Why the use of Indirect anyway? I think that's the problem.

    I can make it work like this

    =AND(MOD(ROW(),2)>0,A1-A2>0)
    Set the applies to range to $A$2:$A$xx

  5. #5
    Registered User
    Join Date
    03-22-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2012
    Posts
    7

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Wonderful. This has been driving me mad all day. A bit new to the formula language. Much appreciated!!!

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

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Cool, glad it worked.

  7. #7
    Registered User
    Join Date
    03-22-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2012
    Posts
    7

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Yeah, had to make a few changes per the way my sheet was set up (with header)

    =AND(MOD(ROW(),2)>0,H3-H2<0)

    I just dont understand how something as simple as H3-H2<0 as a formula is applied to the whole column, and they dont reference H3 & H2 when at rows beyond 3

    like say h3-h2 is -100.00

    then h5-h4 is 0.00

    Why doesn't the conditional formatting reference H3/H2 and subtract to get -100 again since it explicitly cites those cells in the formula? how does it know I want it applied in sets of two rows?

    It works, i'm just curious. i was thinking in a way that made it seem much more complex than that.

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

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    What you see in the Manage Rules Dialogue, is a representation of what the formula looks like in the top left cell of the "Applies To" Range.
    It can't realistically show that formula per each cell in the Applies To range.

    In the exectution of the conditional formatting rule, Excel is being smart enough to incriment those cell references by one row as it goes through the Applies To Range.

  9. #9
    Registered User
    Join Date
    03-22-2013
    Location
    Maryland
    MS-Off Ver
    Excel 2012
    Posts
    7

    Re: Conditional Formatting Formula /w multiple criteria; formulas work indiv, not together

    Interesting. I should put more faith in excel rather than spending hours complicating things. Thanks so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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