IF Not Blank in Excel: do something only when a cell has a value

By Srini Vanamala / September 29, 2026 / Formulas & Functions
IF Not Blank in Excel: do something only when a cell has a value

A formula copied down a whole column shows 0 or errors on the rows that are not filled in yet. Test for “not blank” first.

The formula

=IF(A2<>"",A2*100,"")

<>"" means “is not empty”. If A2 has something, calculate; otherwise show nothing.

The reverse: if blank

=IF(A2="","Missing","OK")

Or =IF(ISBLANK(A2),"Missing","OK").

Two cells must both be filled

=IF(AND(A2<>"",B2<>""),B2-A2,"")

Days between two dates, only when both dates exist. See IF with AND/OR.

Either cell filled

=IF(COUNTA(A2:C2)>0,"Started","")

Why ISBLANK says FALSE on an “empty” cell

The cell contains a space, or a formula that returns “”. ISBLANK only returns TRUE for truly empty cells. A2="" is TRUE for both empty cells and “” results — that is why the <>"" test is the safer choice. A stray space defeats both; clean with TRIM.

Count or sum only non-blank rows

  • =COUNTIF(A:A,"<>") — how many filled.
  • =SUMIF(A:A,"<>",B:B) — add B where A is filled.

Highlight blanks you must fill

Conditional Formatting › New Rule › Use a formula: =$B2="" with a red fill. See conditional formatting.

← →
Srini Vanamala

20 years with spreadsheets and enterprise systems. Writes one short, plain-English Excel lesson a day. Got an Excel question? learnexceleasycom@gmail.com

Have a question about this lesson?

Ask anything — I read every comment. Your email is never shown.