Search code examples
excelconditional-formatting

Conditional column formatting for cells with values


I need to create conditional cell formatting but only for rows that will not be blank. This Excel file will be used as a template that Python script will fill with data so if there are rows without data, these rows should not be formatted.

As per illustration below, I need to create a formula that will apply conditional formatting for banded columns in two colors- light grey and white.

Is there a better way to implement this rather than creating conditional formatting rule for each cell individually?

Tried this and tested conditions, but no formatting is being done.

enter image description here


Solution

  • Using ISBLANK, MOD, and COLUMN:

    =AND(NOT(ISBLANK(A2)),MOD(COLUMN(A2),2)=1)
    

    enter image description here

    Change the formula separator to ; as necessary, and ensure the Applies to range begins in A2, or whichever cell corresponds to the first row.