Forum Discussion

Clare McKeown's avatar
Clare McKeown
Copper Contributor
Jul 18, 2017
Solved

Conditional Formatting using both current and adjacent cells

Apologies if this is a duplicate - my previous attempt didn't seem to post properly.

 

Hello!

 

I am trying to format a column of cells based on both the number contained within the cells to be formatted AND the value of an adjacent cell, using Office 2007. 

e.g.

Males and females have different healthy ranges: 

Males: between 13 and 20

Females: between 11 and 17

Column V cells say either "Male" or "Female" (from a pull-down menu). 

Column W contains the numerical result entered by user, and is to be colour-formatted red if the result is outwith the appropriate gender-dependent range. 

I have entered the following rule (Excel seems to have added extras quotation marks for me): 

 

="(($W5<11 OR $W5 >17) AND ($V5 = ""Female"")) OR (($W5<13 OR $W5>20) AND ($V5 = ""MALE"")"

 

The above doesnt give me an error message - but it doesnt perform any formatting either!

 

Any help would be appreciated :)

 

 

  • Hi Clare,

     

    I didn't check the logic of your function, just to mention what Excel adds extra quotations since you use incorrect syntaxis for the formula, thus Excel considered it as text.

     

    AND and OR are functions, not operators. Correct syntaxis will be =AND(a,b) not =(a AND b) 

  • Hi Clare,

     

    I didn't check the logic of your function, just to mention what Excel adds extra quotations since you use incorrect syntaxis for the formula, thus Excel considered it as text.

     

    AND and OR are functions, not operators. Correct syntaxis will be =AND(a,b) not =(a AND b) 

    • DataKnight's avatar
      DataKnight
      Copper Contributor

      I have a similar issue. I have 2 columns K and N in my spreadsheet that I need to format. Column K has values which are conditionally formatted based on their value. However I'd like to add a further  conditional format based on whether Column N has a 'y' in it and colour the cell in Column K green but cant get it to work. I have this formula in the cell ....=($N1173 ="y") as an example.

      My rules are attached.

       

      Any help appreciated.

      It's a nice to have requirement rather than a must.

       

      Thanjks

      Ken

      • DataKnight's avatar
        DataKnight
        Copper Contributor
        Just got it working. It seems to need you to put the conditional formatting in the first cell of the appropriate column of the spreadsheet then it propagates down.

        Am I correct?

Resources