SOLVED
Home

Conditional Formatting using both current and adjacent cells

%3CLINGO-SUB%20id%3D%22lingo-sub-88074%22%20slang%3D%22en-US%22%3EConditional%20Formatting%20using%20both%20current%20and%20adjacent%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-88074%22%20slang%3D%22en-US%22%3E%3CP%3EApologies%20if%20this%20is%20a%20duplicate%20-%20my%20previous%20attempt%20didn't%20seem%20to%20post%20properly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20format%20a%20column%20of%20cells%20based%20on%20both%20the%20number%20contained%20within%20the%20cells%20to%20be%20formatted%20AND%20the%20value%20of%20an%20adjacent%20cell%2C%20using%20Office%202007.%26nbsp%3B%3C%2FP%3E%3CP%3Ee.g.%3C%2FP%3E%3CP%3EMales%20and%20females%20have%20different%20healthy%20ranges%3A%26nbsp%3B%3C%2FP%3E%3CP%3EMales%3A%20between%2013%20and%2020%3C%2FP%3E%3CP%3EFemales%3A%20between%2011%20and%2017%3C%2FP%3E%3CP%3EColumn%20V%20cells%20say%20either%20%22Male%22%20or%20%22Female%22%20(from%20a%20pull-down%20menu).%26nbsp%3B%3C%2FP%3E%3CP%3EColumn%20W%20contains%20the%20numerical%20result%20entered%20by%20user%2C%20and%20is%20to%20be%20colour-formatted%20red%20if%20the%20result%20is%20outwith%20the%20appropriate%20gender-dependent%20range.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20entered%20the%20following%20rule%20(Excel%20seems%20to%20have%20added%20extras%20quotation%20marks%20for%20me)%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3D%22((%24W5%26lt%3B11%20OR%20%24W5%20%26gt%3B17)%20AND%20(%24V5%20%3D%20%22%22Female%22%22))%20OR%20((%24W5%26lt%3B13%20OR%20%24W5%26gt%3B20)%20AND%20(%24V5%20%3D%20%22%22MALE%22%22)%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20above%20doesnt%20give%20me%20an%20error%20message%20-%20but%20it%20doesnt%20perform%20any%20formatting%20either!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20would%20be%20appreciated%20%3A)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-88074%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%20Desktop%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20%26amp%3B%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-340047%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20using%20both%20current%20and%20adjacent%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-340047%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20if%20you%20use%20the%20rule%20with%20the%20formula%2C%20you%20write%20the%20formula%20for%20the%20first%20cell%20of%20your%20range.%20It%20is%20applied%20to%20other%20cells%20of%20the%20range%20approximately%20the%20same%20way%20as%20if%20you%20write%20formula%20for%20the%20one%20cell%20and%20that%20drag%20it%20down.%20Other%20words%20you%20shall%20take%20care%20about%20absolute%20and%20relative%20references%20in%20your%20formula.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-339318%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20using%20both%20current%20and%20adjacent%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-339318%22%20slang%3D%22en-US%22%3EJust%20got%20it%20working.%20It%20seems%20to%20need%20you%20to%20put%20the%20conditional%20formatting%20in%20the%20first%20cell%20of%20the%20appropriate%20column%20of%20the%20spreadsheet%20then%20it%20propagates%20down.%3CBR%20%2F%3E%3CBR%20%2F%3EAm%20I%20correct%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-339300%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20using%20both%20current%20and%20adjacent%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-339300%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20similar%20issue.%20I%20have%202%20columns%20K%20and%20N%20in%20my%20spreadsheet%20that%20I%20need%20to%20format.%20Column%20K%20has%20values%20which%20are%20conditionally%20formatted%20based%20on%20their%20value.%20However%20I'd%20like%20to%20add%20a%20further%26nbsp%3B%20conditional%20format%20based%20on%20whether%20Column%20N%20has%20a%20'y'%20in%20it%20and%20colour%20the%20cell%20in%20Column%20K%20green%20but%20cant%20get%20it%20to%20work.%20I%20have%20this%20formula%20in%20the%20cell%20....%3D(%24N1173%20%3D%22y%22)%20as%20an%20example.%3C%2FP%3E%3CP%3EMy%20rules%20are%20attached.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20appreciated.%3C%2FP%3E%3CP%3EIt's%20a%20nice%20to%20have%20requirement%20rather%20than%20a%20must.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanjks%3C%2FP%3E%3CP%3EKen%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-89060%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20using%20both%20current%20and%20adjacent%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-89060%22%20slang%3D%22en-US%22%3EThanks%20Sergei%20-%20all%20fixed%20now%2C%20much%20appreciated%20%3A)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-88080%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20using%20both%20current%20and%20adjacent%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-88080%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Clare%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20didn't%20check%20the%20logic%20of%20your%20function%2C%20just%20to%20mention%20what%20Excel%20adds%20extra%20quotations%20since%20you%20use%20incorrect%20syntaxis%20for%20the%20formula%2C%20thus%20Excel%20considered%20it%20as%20text.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAND%20and%20OR%20are%20functions%2C%20not%20operators.%20Correct%20syntaxis%20will%20be%20%3DAND(a%2Cb)%20not%20%3D(a%20AND%20b)%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Clare McKeown
New Contributor

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 :)

 

 

5 Replies
Solution

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) 

Thanks Sergei - all fixed now, much appreciated :)

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

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?

Yes, if you use the rule with the formula, you write the formula for the first cell of your range. It is applied to other cells of the range approximately the same way as if you write formula for the one cell and that drag it down. Other words you shall take care about absolute and relative references in your formula.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies