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

Microsoft Excel is an Excellent software to process data effectively. In this article, we will learn to calculate if the cell is not blank using Excel formulas.


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

In this article, we need to use the IF function for all the methods to calculate if the cell is not blank in Excel. We will use other functions along with the IF function check blanks and calculate.

IF function is one of the most used functions of Excel. This is a logical function used to compare between a value and what we want and give the result. IF statement has two results. The first result is if our comparison is True, the second is if our comparison is False.

Syntax:

IF(logical_test, value_if_true, [value_if_false])

Arguments:

logical_test – The condition we set to test.The condition you want to test.

value_if_true – If the logical test is True, the function returns a value. That value is set here.

value_if_false – If the logical test is False, the function returns this value.

In the data set, we consider some employees working in a company with their salary.

Data set to calculate if cell is not blank using Excel formulas


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

In this section, we will use the combination of IF & AND functions.

The AND function is a logical test. It tests if all the conditions are correct and then returns TRUE. Or if any of the conditions are not fulfilled then returns FALSE.

Syntax:

AND(logical1, [logical2], …)

Arguments:

logical1 – It is the first condition that we want to test that can be considered being either TRUE or FALSE.

logical2, … Additional conditions that we want to test that can be considered is either TRUE or FALSE. We can set up to a maximum of 255 conditions.

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:

  • Now, press Enter.

Here, we get a SUM calculation as the comparing cells contain data.

Step 4:

  • Now, delete the data of Cell B7 and see what happens.

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

So, if any blank cell is found, no calculation will be done.


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

The OR function is a logical function. It is used to decide if any states in a test are TRUE.

It returns TRUE if any of its arguments evaluate to valid, and returns FALSE if all of its arguments evaluate to wrong.

Syntax:

OR(logical1, [logical2], …)

Arguments:

logical1 – It is the first condition that we want to test that can be considered either TRUE or FALSE.

logical2, … – Additional conditions that we want to test that can be considered either TRUE or FALSE. We can set up to a maximum of 255 conditions.

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:

  • Then, press Enter.

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

As our comparing cells contain data, we are getting 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.


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

The ISBLANK function is a version of IS group of functions. It checks any value or cell and returns TRUE if found blank. Otherwise, FALSE will show in the result.

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 the Enter.

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

Step 3:

  • Now, delete data from any of the reference cells to see what happens.

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


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

The COUNTA function counts the number of cells that are not blank in a specific range.

Syntax:

COUNTA(value1, [value2], …)

Arguments:

value1 – The first argument describes the values that we want to count.

value2, … – Additional arguments describing the values that we want to count. We can set up a maximum of 255 arguments.

Step 1:

  • Again, 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:

  • Then, press Enter.

In our formula, we have taken 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:

  • Now, 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.

Read More: How to Return Value If Cell is Blank


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

The COUNTBLANK function is one of the Statistical functions. It is used to count the number of empty cells in a range.

Syntax:

COUNTBLANK(range)

Argument:

Range – The range from which we want to count the blank cells.

Step 1:

  • We will 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:

  • Then, press Enter.

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

Step 3:

  • Now, put random data in Cell B9 and see what happens.

Now, no blank cells are present in the range and show the sum result.


6. COUNTIF Operation to Compute Total for Non-blank Cells

The COUNTIF function is one of the statistical functions. This is used to count the number of cells that satisfy a criterion.

Syntax:

COUNTIF(range, criteria)

Arguments:

range – It is the group of cells we want to count. The range can contain numbers, arrays, a named range, or references that contain numbers.

criteria – It may be a number, expression, cell reference, or text string that determines which cells will be counted.

Step 1:

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

COUNTIF Operation to calculate If Cell is Not Blank

Step 2:

  • Now, press Enter.

We can see no result after applying the formula.

Step 3:

  • We add random data in Cell B9.

COUNTIF Operation to calculate If Cell is Not Blank

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


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

The SUMPRODUCT function results from the sum of the products of corresponding ranges or arrays. The default operation is multiplication, but addition, subtraction, and division are also possible.

Syntax:

=SUMPRODUCT(array1, [array2], [array3], …)

Arguments:

array1 – It is the first array argument whose components we want to multiply and then add.

[array2], [array3],… Those are optional argument. We can add up to 255 arguments.

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:

  • Now, press Enter.

Step 3:

  • Now, 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.

Read More: Excel If Two Cells Are Blank Then Return Value


Download Practice Workbook

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


Conclusion

In this article, we described 7 methods to calculate if the cell is not blank using Excel formulas. I hope this will satisfy your needs. Feel free to give your suggestions in the comment box.


Related Articles


<< Go Back to Blank Cells | 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