30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / SUMIF Not-Blank (Sum Values for Non-Empty Cells)
By Puneet Gogia (Microsoft MVP)

SUMIF Not-Blank (Sum Values for Non-Empty Cells)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

To sum only the rows where a cell has something in it, use "<>" as the criteria: =SUMIF(A2:A13,"<>",B2:B13) adds up column B for every row where column A isn’t empty. The <> on its own means “not equal to nothing”, which Excel reads as not-blank. SUMIFS works the same way with the ranges reversed: =SUMIFS(B2:B13,A2:A13,"<>").

One thing to watch: a cell containing only a space isn’t blank, so it gets included and inflates your total. To catch those too, use =SUMPRODUCT(--(LEN(TRIM(A2:A13))>0),B2:B13), which trims each cell before testing its length.

In Excel 365 or 2021 there’s a more readable option: =SUM(FILTER(B2:B13,A2:A13<>"")). And note that a cell holding a formula that returns “” looks empty but is counted as non-blank by "<>", so on a sheet full of formulas the SUMPRODUCT version is safer.

Let’s say you organized a charity event and collected donations from different people. You have a list of those who provided their names and donations, while others chose to donate anonymously.

Your goal is to find out the total amount of donations from those who provided their names.

In Excel, you can use SUMIF to sum the values for the non-blank cells. For this, you need to specify a non-blank value (“<>”, does not equal to, made with the less than and greater than operators) in the criteria argument of the function.

With this, SUMIF will look only for non-empty cells and only consider values from the [sum_range] according to that. Below, we have calculated the sum of donations with names.

sumif-non-blank-cells

Let’s write a formula for this…

Using SUMIF for Not Blank Cells

Here, we need to write a formula to add up the donations listed in column B, but only if the corresponding name in column A is not empty.

Quick Intro to SUMIF: The SUMIF function in Excel adds up the values in a range that meets a specified condition or criterion. It combines the functionality of the SUM and IF functions, allowing you to filter and sum data based on criteria.

  1. First, in the cell, enter =SUMIF(.
  2. Now, in the criteria range, refer to the range A2:A13.
  3. Next, enter the criteria for not blank cells using “<>”.
  4. After that, in the [sum_range] argument, refer to the range B2:B13.
  5. In the end, enter the closing parenthesis and hit Enter to get the result.
use-sumif-for-non-blank-cells

When you enter the formula and hit Enter, it returns the sum of the donations for only those cells where you have a name in the name column.

sumif-result-for-non-blank-cells
=SUMIF(A2:A13,"<>",B2:B13)

The SUMIF function checks each cell in the range A2:A13 (criteria range). For every cell that is not empty (indicated by the “<>”), it includes the corresponding cell for donation amount from the same row in the range B2:B13.

It ensures that only the donations with a name are counted. In this case, the total is 2736, as shown in cell D2.

In the same way, if you want to sum non-blank cells using the SUMIFS instead of the SUMIF, you can write a formula like the following:

=SUMIFS(B2:B13, A2:A13, "<>")

Like SUMIF, this formula looks at each cell in A2 to A13. If a cell is not blank, it takes the values of the corresponding cells from B2 to B13 and adds them to the total. If a cell in A2 to A13 is blank, the corresponding cells in B2 to B13 are ignored.

=SUMIFS(B2:B13, A2:A13, "<>", C2:C13, ">10", C2:C13, "<=20")

The benefit of SUMIFS is that you can add more conditions along with the non-blank one. The above formula sums the donations only where the name is not blank and the value in column C is greater than 10 and less than or equal to 20.

When using the SUMIF, you can type the criteria directly into the formula or refer to a cell containing the criteria. Typing the criteria directly, like “<>,” is called using hard values.

This approach works perfectly but can make the formula less flexible. If you need to change the criteria, you must edit the formula every time, which can be time-consuming.

On the other hand, referring to a cell for the criteria makes your formula more dynamic. Instead of typing “<>” into the formula, you can type it into a cell and refer to that cell in the formula.

For example, if you type <> in cell D1, the formula becomes:

=SUMIF(A2:A13,D1,B2:B13)

SUMPRODUCT to SUM Actual Non-Empty Cells

Let’s say you have a blank cell and a blank space in that cell. Now, this cell looks like an empty cell, but it is not empty.

sumproduct-to-sum-actual-non-empty-cells

In this situation, SUMIF will also calculate that cell’s sum.

sumif-counts

To deal with this problem, you can use a combination of SUMPRODUCT, LEN, and TRIM. With this combination, you can create an array formula. See the example below.

sumproduct-len-trim-combination
=SUMPRODUCT(--(LEN(TRIM(A2:A13))>0),B2:B13)

When you enter this function, it removes those blank spaces from the cells using TRIM. But there’s one thing that you need to know about SUMPRODUCT. It can take an entire array in a single cell without using the CTRL + SHIFT + ENTER keys.

Now, let’s break this formula into five small parts to understand it and see how this amazing formula works.

In the first part, we used the TRIM and referred to the entire name column. TRIM takes values from the column and removes space from the cells where you only have space(s). These are those cells that have no value but seem like non-blank cells.

first-trim-part

In the second part, we have LEN, which counts the length of the characters in the name column. For all cells where you don’t have any value, the count of the characters would be zero.

second-len-part

As you can see, we have values above zero for all the non-empty cells.

We used a greater than operator in the third part to compare the LEN and TRIM’s result returns. This operator converts the count into TRUE and FALSE. For a count above zero, it is TRUE; otherwise, it is FALSE.

used-greater-than-operator

In the fourth part, we have a double minus sign that converts these TRUE and FALSE values into 1 and 0. For TRUE, a 1 and for FALSE, a 0.

double-minus-to-convert-true-and-false

After that, in the fifth part, we have SUMPRODUCT with two arrays. When these arrays are multiplied with each other, you get the sum only for the cells that are not blank and don’t have an invisible space.

Combining FILTER with SUM to Sum Not Blank Cells

Using the FILTER function with the SUM function can be a powerful way to sum up not blank cells in Excel. This method is beneficial in dynamic arrays where you want to sum only the cells that meet specific criteria, such as being non-blank. FILTER is available in Excel for Microsoft 365, Excel 2021 and later, and Excel for the web.

=SUM(FILTER(B2:B13, A2:A13 <> ""))

The FILTER function examines the range B2 to B13 and only includes values for which the corresponding cells in A2 to A13 are not empty.

It simply checks each cell in the range A2 to A13. If a cell is not blank, it takes the value from the same row in B2 to B13 and includes it in the sum. If a cell in A2 to A13 is blank, the value from B2 to B13 is ignored.

If none of the names are filled in, FILTER has nothing to return and gives the #CALC! error. To get 0 instead, use the third argument of FILTER:

=SUM(FILTER(B2:B13, A2:A13 <> "", 0))

Cells with Formulas That Return a Blank

If the name column has formulas that return an empty text (“”), those cells look blank, but SUMIF with “<>” treats them as not blank and adds their values. When your names are text, use the wildcard “?*” instead, which only matches cells with at least one character:

=SUMIF(A2:A13,"?*",B2:B13)

Just note that “?*” only works with text, so it skips cells that have numbers, and it still counts a cell with only a space. Another way is the following SUMPRODUCT formula, which skips the cells with “” formulas but not the cells with spaces (use the LEN and TRIM version above for those):

=SUMPRODUCT((A2:A13<>"")*B2:B13)

Sum When Two Columns Are Not Blank

Let’s say you only want to add a donation when both the name (column A) and column C are filled in. Use SUMIFS with a “<>” condition for each column:

=SUMIFS(B2:B13,A2:A13,"<>",C2:C13,"<>")

Frequently Asked Questions

Does SUMIF treat a cell with a space as blank?

No. A space is a character, so “<>” treats that cell as not blank and adds its value. Use the SUMPRODUCT, LEN and TRIM formula above to skip those cells.

What is the difference between “<>” and “<>0” in SUMIF?

“<>” matches any cell that is not empty. “<>0” matches any cell that is not equal to zero, and that includes empty cells too, so it’s not a way to skip blanks.

Do I need to check the sum range for blanks?

No. Blank cells in the sum range add nothing, so SUM and SUMIF give the same total with or without them. The non-blank check matters only for the criteria range.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment