Excel INDIRECT function and conditional formatting - highlighting a row

7,089

Solution 1

I don't see any need for INDIRECT, "not blank" is <>"" so perhaps try

=AND($B2<>"",$F2="")

Solution 2

Your issue could be where you start to apply the conditional formatting. The answer with = AND ($B2 > 0, $F2 = "") assumes you are applying your conditional formatting row 2 of any column.

For example if you are applying your conditional formatting rule to an entire column the first row that the rule is applied needs to be the row number in your formula. You would simply highlight the entire column then type = AND ($B1> 0, $F1 = "")

If you are applying the formatting to G5 through G7 this is what you would input. = AND ($B5 > 0, $F5 = "")

Relative references will start where your formula starts then proceed to copy itself across the range you are applying the rule to. That's why the $ isn't present on the number. So the rule can move down with your range.

Share:
7,089

Related videos on Youtube

Ehryk
Author by

Ehryk

I'm a Computer (Web) Programmer/Analyst based in Anchorage, AK and Minneapolis, MN. I use (among other things) ASP.NET, C# and SQL Server. I build things. Bicycles, computers, websites, guitars, cars, motorcycles, sound sytems... lots of things. Resume: http://ericmenze.com Personal Website: http://ehryk.com Pause your videos at specific locations: http://pauseforlater.com Calculate and build spoked bicycle wheels: http://wheelspoking.com See activity specific analysis of your GPX Files: http://gpxdataanalyzer.com Tool to open command/powershell prompts from any location (Windows): https://github.com/Ehryk/ContextMenuTools

Updated on September 18, 2022

Comments

  • Ehryk
    Ehryk over 1 year

    I'm having an issue with conditional formatting using the INDIRECT function. I'm doing something similar to Using INDIRECT and AND/IF for conditional formatting , but the only answer there isn't working for me.

    Basically, I want to highlight rows where B is not blank and F is blank. INDIRECT will work for ONE of the conditions, but

    = AND(INDIRECT("B"&ROW()) > 0, INDIRECT("F"&ROW()) = "") 
    

    does not work at all.

    The answer in the question points to replacing the references with relative ones, so I'm thinking this should work:

    = AND ($B2 > 0, $F2 = "")
    

    But it does not, nor does ISBLANK($F@) or ISEMPTY($F2) (the cell contains a formula that sometimes will return "", I want the row highlighted in these cases but only when something is in column B).

    Am I missing something about relative references? Why doesn't INDIRECT work with AND/OR?