Search code examples
excelconditional-formattingboolean-expression

format in excel with multiple conditions


I am trying to format in Excel using multiple conditions.

If I use:

=INDIRECT(ADDRESS(ROW(),COLUMN()))="_"

It works fine, all cells with the value "_" are formatted.

If I use:

=MOD(ROW(),2)

It also works fine, all cells in odd numbered rows are formatted.

I would like to format only if both conditions are true.
I tried:

=AND(INDIRECT(ADDRESS(ROW(),COLUMN()))="_", MOD(ROW(),2))

as well as:

=IF(INDIRECT(ADDRESS(ROW(),COLUMN()))="_", IF(MOD(ROW(),2),TRUE,FALSE),FALSE)

How can I combine the two conditions and only highlight cells in odd rows with the value "_"?


Solution

  • Use:

    =(INDIRECT(ADDRESS(ROW(),COLUMN()))="_")*ISODD(ROW())
    

    enter image description here

    You can try formula without INDIRECT:

    =(A1="_")*ISODD(ROW())
    

    Change A1 to first cell reference from Applies to range