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.


Download Practice Workbook

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


7 Excel Formulas to Calculate If Cells are Not Blank

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 and check blanks and calculate.

IF Function is one of the largely 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 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 then returns TRUE. Or if any of the conditions do not fulfill then returns FALSE.

Syntax:

AND(logical1, [logical2], …)

Arguments:

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

logical2, … Additional conditions that we want to test that can consider being 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 are containing 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 consider either TRUE or FALSE.

logical2, … – Additional conditions that we want to test that can consider 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 are containing data, so 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.


Similar Readings:


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 blank 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 on like 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.


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. Please have a look at our website Exceldemy.com and give your suggestions in the comment box.


Further Readings

Alok

Alok

Hello, this is Alok. I am working as an Excel & VBA Content Developer at Exceldemy. I want to provide solutions to various Excel-based problems. I completed my study at East West University major in Telecommunications Engineering. I love traveling, reading books, playing cricket.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo