How to Calculate in Excel If Cells are Not Blank: 7 Exemplary Formulas

Method 1 – Combine IF and AND Functions to Calculate If Cells are Not Blank

Step 1:

  • Add a row to show the calculation.

Step 2:

  • Go to Cell C14.
  • Write the formula, and that is:
=IF(AND(B7<>"",B8<>""),C7+C8,"")

Combine IF and AND Functions to Calculate If Cell is Not Blank

Step 3:

  • Press Enter.

Get a SUM calculation as the comparing cells contain data.

Step 4:

  • Delete the data of Cell B7 and see what happens.

Combine IF and AND Functions to Calculate If Cell is Not Blank

Any blank cell is found, no calculation will be done.


Method 2 – Apply IF and OR Functions to Calculate for Non-blank Cells

Step 1:

  • Go to Cell C14.
  • Write the combination of the IF & OR formula. The formula will:
=IF(OR(B7="",B8=""),"",C7+C8)

Apply IF and OR Functions to Calculate If Cell is Not Blank

Step 2:

  • Press Enter.

Apply IF and OR Functions to Calculate If Cell is Not Blank

As our comparing cells contain data, we get a sum result after calculation.

Step 3:

  • We want to see what happens with blank cells.
  • Delete data from Cell B7.

We see that blank is showing, no calculation is done because of blank cells.


Method 3 – Combine ISBLANK and OR Functions to Calculate for Non-empty Cells

Step 1:

  • Write the formula in Cell C14. The formula will be:
=IF(OR(ISBLANK(B7),ISBLANK(B8)),"",C7+C8)

Insert ISBLANK and OR Functions to Calculate

Step 2:

  • Press Enter.

As our reference cells contain data, we get a result after calculation.

Step 3:

  • Delete data from any of the reference cells to see what happens.

We get blank in the return, as one cell is blank.


Method 4 – Join COUNTA and IF to Sum Non-empty Cells Only

Step 1:

  • Go to Cell C14 and write the following formula.
=IF(COUNTA(B5:B12)=8,SUM(C5:C12),"")

Use COUNTA and IF Functions If Cell is Not Blank

Step 2:

  • Press Enter.

All the data of the Name column. The COUNTA function counts the number of cells with data and compares it with the total cell number of that range. As the comparison doesn’t match with the range number no calculation is performed.

Step 3:

  • Add random data on Cell B9.

Use COUNTA and IF Functions If Cell is Not Blank

We can see a return now; no cell is blank now.


Method 5 – Join IF and COUNTBLANK to Sum Non-blanks with Blank Cells Inside

Step 1:

  • Write the COUNTBLANK function in Cell C14. The formula will be:
=IF(COUNTBLANK(B5:B12),"",SUM(C5:C12))

COUNTBLANK and IF Functions to Calculate If Cell is Not Blank

Step 2:

  • Press Enter.

As the formula found blank cells in the selected range, no result shows.

Step 3:

  • Put random data in Cell B9 and see what happens.

No blank cells are present in the range and show the sum result.


Method 6 – COUNTIF Operation to Compute Total for Non-blank Cells

Step 1:

  • Go to Cell C14.
  • Write the following formula:
=IF(COUNTIF(B5:B12,"")>0,"",SUM(C5:C12))

COUNTIF Operation to calculate If Cell is Not Blank

Step 2:

  • Press Enter.

We can see no result after applying the formula.

Step 3:

  • Add random data in Cell B9.

COUNTIF Operation to calculate If Cell is Not Blank

We get results as we don’t have any blanks in our selected range.


Method 7 – Join SUMPRODUCT and IF to Sum the Data with Blank Cells Inside

Step 1:

  • Apply the SUMPRODUCT function with the following formula:
=IF(SUMPRODUCT(--(B5:B12=""))>0,"",SUM(C5:C12))

Join SUMPRODUCT and IF to Calculate If Cell is Not Blank

Step 2:

  • Press Enter.

Step 3:

  • Put a name in the blank cell of the Name column.

Join SUMPRODUCT and IF to Calculate If Cell is Not Blank

We can see the desired result is showing because all the cells are filled with data.


Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Related Articles


<< Go Back to Excel Cells | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Alok Paul
Alok Paul

Alok Paul has completed his B.Sc. in Electronics and Telecommunication Engineering from East West University. He has been working on the ExcelDemy project for more than 2 years. He has written 220+ articles and replied to numerous comments. He is experienced in Microsoft Office, especially in Excel. He also led some teams on Excel and VBA content development. He has a keen interest in Advanced Excel, Data analysis, Excel Pivot Table, Charts, and Dashboard. He loves to research... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo