Conditional formatting with multiple conditions not working

%3CLINGO-SUB%20id%3D%22lingo-sub-2154489%22%20slang%3D%22en-US%22%3EConditional%20formatting%20with%20multiple%20conditions%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2154489%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20looking%20for%20some%20help%20with%20my%20conditional%20formatting%20formula%20as%20it%20keeps%20returning%20an%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20highlight%20a%20cell%20in%20column%20D%20if%20it%20is%20blank%20and%20if%20column%20I%20contains%20%22Community%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DAND(%24D%24D%3D%22%20%22%2C%24I%24I%3D%22Community%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-02-22%20095325.png%22%20style%3D%22width%3A%20372px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F256424iC4C55FC2304BB469%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-02-22%20095325.png%22%20alt%3D%22Screenshot%202021-02-22%20095325.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2154489%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2154606%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20formatting%20with%20multiple%20conditions%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2154606%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F974095%22%20target%3D%22_blank%22%3E%40Paula2325%3C%2FA%3E%26nbsp%3BSo%20I%20assume%20you%20are%20applying%20this%20format%20to%20a%20range%20in%20column%20D.%26nbsp%3B%20You%20have%20a%20couple%20problems.%26nbsp%3B%201st%2C%20to%20refer%20to%20an%20entire%20column%20you%20need%20a%20%22%3A%22%20in%20between%20so%20it%20would%20look%20like%20%24D%3A%24D.%26nbsp%3B%20BUT%202nd%20and%20more%20important%20you%20don't%20want%20to%20refer%20to%20the%20entire%20column%20(at%20least%20I%20don't%20think%20that%20is%20what%20you%20are%20trying%20to%20do).%26nbsp%3B%20conditional%20formatting%20looks%20at%20the%20upper%20left%20cell%20of%20the%20range%20you%20are%20applying%20it%20to%20and%20evaluates%20the%20formula%20and%20then%20moves%20cell%20to%20cell%20and%20adjusts%20the%20formula%20accordingly.%26nbsp%3B%20What%20that%20means%20is%20you%20only%20want%20to%20write%20the%20formula%20as%20if%20you%20are%20ONLY%20interested%20in%20the%20upper%20left%20cell%20of%20the%20range.%3C%2FP%3E%3CP%3ESo%20if%20your%20range%20is%20%24D%3A%24D%20(the%20entire%20column%20of%20D)%20then%20D1%20is%20the%20upper%20left%20and%20the%20formula%20you%20want%20is%3A%3C%2FP%3E%3CP%3E%3DAND(%24D1%3D%22%22%2C%24I1%3D%22Community%22)%3C%2FP%3E%3CP%3EPlease%20NOTE%20that%20I%20did%20NOT%20use%20%22%24%22%20before%20the%20row%20%23s%2C%20because%20you%20want%20Excel%20to%20increment%20D1%20to%20D2%20to%20D3%2C%20etc...%20as%20it%20goes%20down%20the%20column.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2154631%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20formatting%20with%20multiple%20conditions%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2154631%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3Bthanks%20for%20your%20solution.%20I%20had%20amended%20my%20formula%20to%3C%2FP%3E%3CP%3E%3DAND(ISBLANK(D2)%2CI2%3D%22Community%20%22)%20(yes%20there%20is%20a%20space%20after%20community%20as%20it's%20coming%20from%20a%20drop%20down%20selection)%20and%20tried%20it%20in%20a%20dummy%20column%20to%20get%20a%20true%2Ffalse%20and%20it%20worked%20but%20when%20I%20applied%20it%20in%20the%20conditional%20formatting%20it%20wasn't%20working%20as%20expected.%3C%2FP%3E%3CP%3EOn%20closer%20inspection%20there%20were%20so%20many%20rules%20already%20set%20up%20that%20I%20think%20it%20was%20interfering%20with%20the%20new%20rule%20(it's%20not%20my%20spreadsheet).%20So%20I%20cleared%20out%20all%20the%20rules%20that%20weren't%20doing%20anything%20and%20my%20conditional%20formatting%20is%20now%20working%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2154911%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20formatting%20with%20multiple%20conditions%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2154911%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F974095%22%20target%3D%22_blank%22%3E%40Paula2325%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20a%20comment%3C%2FP%3E%0A%3CP%3E1)%20As%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3Bmentioned%20it's%20always%20better%20to%20lock%20the%20columns%20in%20references%2C%20like%26nbsp%3B%3CSPAN%3E%3DAND(ISBLANK(%24D2)%2C%24I2%3D%22Community%20%22)%20even%20if%20you%20apply%20the%20rule%20only%20to%20the%20range%20in%20one%20column%2C%20e.g.%20to%20A2%3AA1000.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E2)%20As%20a%20rule%20keep%20one%20conditional%20formatting%20rule%20for%20one%20color%20%2F%20format%20applied%2C%20avoid%20using%20different%20rules%20which%20return%20the%20same%20formatting.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I'm looking for some help with my conditional formatting formula as it keeps returning an error.

 

I want to highlight a cell in column D if it is blank and if column I contains "Community"

 

=AND($D$D=" ",$I$I="Community")

 

Screenshot 2021-02-22 095325.png

3 Replies

@Paula2325 So I assume you are applying this format to a range in column D.  You have a couple problems.  1st, to refer to an entire column you need a ":" in between so it would look like $D:$D.  BUT 2nd and more important you don't want to refer to the entire column (at least I don't think that is what you are trying to do).  conditional formatting looks at the upper left cell of the range you are applying it to and evaluates the formula and then moves cell to cell and adjusts the formula accordingly.  What that means is you only want to write the formula as if you are ONLY interested in the upper left cell of the range.

So if your range is $D:$D (the entire column of D) then D1 is the upper left and the formula you want is:

=AND($D1="",$I1="Community")

Please NOTE that I did NOT use "$" before the row #s, because you want Excel to increment D1 to D2 to D3, etc... as it goes down the column.  

Lastly, to check if the cell is blank you could use ISBLANK($D1) but the problem with that or the above ="" is that sometimes people like to "clear"/"erase" a cell by hitting <space><enter> which really doesn't make it blank but rather =" " (have a space character in it).  If you want to ignore spaces and accept blank looking cells as blank, then you can use TRIM($D1)=""

@mtarler thanks for your solution. I had amended my formula to

=AND(ISBLANK(D2),I2="Community ") (yes there is a space after community as it's coming from a drop down selection) and tried it in a dummy column to get a true/false and it worked but when I applied it in the conditional formatting it wasn't working as expected.

On closer inspection there were so many rules already set up that I think it was interfering with the new rule (it's not my spreadsheet). So I cleared out all the rules that weren't doing anything and my conditional formatting is now working

 

Thanks for your help.

@Paula2325 

As a comment

1) As @mtarler mentioned it's always better to lock the columns in references, like =AND(ISBLANK($D2),$I2="Community ") even if you apply the rule only to the range in one column, e.g. to A2:A1000.

2) As a rule keep one conditional formatting rule for one color / format applied, avoid using different rules which return the same formatting.