Google Sheets SUMIF Not Empty: Formula & Fixes

How-to basics · Updated November 23, 2026

To sum cells in Google Sheets only when a corresponding cell is not empty, use the formula =SUMIF(range, "<>", sum_range). This tells SUMIF to add up values where the criteria range contains any non-empty cell, including cells with text, numbers, or errors.

What SUMIF Does and Why Empty Cells Matter

SUMIF is a conditional summing function. It checks a range against a condition and adds only the values that match. When you want to exclude blank cells, the condition “<>" (meaning “not equal to nothing”) is the standard approach. Without it, SUMIF treats blank cells as zero, which is fine for arithmetic but can produce misleading results if you’re summing only rows that have data in another column.

For example, if column A has product names and column B has sales, but some rows in A are blank, you might want to sum only the sales for rows with a product name. The formula =SUMIF(A2:A100, "<>", B2:B100) does exactly that.

How to Use the Not-Empty Criterion Correctly

The syntax is =SUMIF(range, criterion, [sum_range]). The criterion is a text string that defines the condition. For “not empty,” you use "<>" (the less-than and greater-than symbols together). Here’s how to apply it:

  • If your data is in columns A (criteria) and B (values), enter =SUMIF(A2:A100, "<>", B2:B100).
  • If you want to sum the same range you’re checking (e.g., sum numbers in A that are not blank), use =SUMIF(A2:A100, "<>").
  • For non-empty text specifically (excluding numbers), you’d need a different approach, as “<>” includes numbers.

Note that “<>” also includes cells with errors (like #N/A) and cells with spaces. If you want to exclude truly blank cells but include cells with spaces, this works; if you want to exclude spaces too, you’ll need a more complex formula with FILTER or SUMPRODUCT.

Common Problems and How to Fix Them

Several issues can arise when using SUMIF with not-empty criteria:

  • Spaces that look empty: A cell with a space character is not empty. To exclude those, use =SUMIF(A2:A100, "?*", B2:B100) which matches cells with at least one character, but this also excludes numbers. A better fix is to use =SUMPRODUCT((A2:A100<>"")*(B2:B100)) which treats spaces as non-empty too.
  • Summing the wrong range: If you omit sum_range, SUMIF sums the range itself. If you include it, make sure it’s the same size as the range.
  • Criteria with wildcards: The asterisk (*) and question mark (?) are wildcards. If your data contains these characters, they might be misinterpreted. To treat them literally, use a tilde (~) before them, like "~*".
  • Case sensitivity: SUMIF is not case-sensitive. If you need case-sensitive matching, use SUMPRODUCT with EXACT.

Alternatives: SUMIFS, FILTER, and SUMPRODUCT

SUMIFS is the multi-condition version. For not-empty, you can use =SUMIFS(B2:B100, A2:A100, "<>"). However, SUMIFS also treats spaces as non-empty. If you need to exclude spaces, use FILTER:

=SUM(FILTER(B2:B100, A2:A100<>"")) – this returns an array of values where A is not blank, then sums them. Note that this still includes spaces.

For a strict check that excludes spaces and truly blank cells, use SUMPRODUCT with TRIM:

=SUMPRODUCT((TRIM(A2:A100)<>"")*(B2:B100)) – this removes spaces before checking, so a cell with only spaces is treated as empty.

How to Count Non-Empty Cells (Not Sum)

If you want to count non-empty cells instead of summing them, use COUNTA. For example, =COUNTA(A2:A100) counts all non-empty cells in that range. To count only non-empty cells that also meet another condition, use COUNTIFS with “<>“. For instance, =COUNTIFS(A2:A100, "<>", B2:B100, ">10") counts rows where A is not empty and B is greater than 10.

Real-World Example with a Sample Dataset

Suppose you have a list of orders where column A has customer names (some blank) and column B has order amounts. You want the total sales from customers with a name listed.

With names in A2:A10 and amounts in B2:B10:

=SUMIF(A2:A10, "<>", B2:B10)

If the amounts are 100, 200, 300, 400, 500 in rows 2-6, and rows 7-10 have no names, the formula returns 1500 (the sum of 100+200+300+400+500). If you had accidentally used =SUMIF(A2:A10, "*", B2:B10), it would return the same because all names are text, but if any name were a number, it would fail.

Frequently Asked Questions

Why does SUMIF with “<>” still include cells with spaces?
Because a space is a character, so the cell is not empty. To exclude spaces, use =SUMPRODUCT((TRIM(A2:A100)<>"")*(B2:B100)).

Can I use SUMIF to sum based on non-empty in another sheet?
Yes, just reference the sheet, like =SUMIF(Sheet2!A2:A100, "<>", Sheet2!B2:B100).

What if I want to sum only non-empty cells that contain numbers?
Use =SUMIF(A2:A100, ">=0", B2:B100) but that includes zeros. Better: =SUMPRODUCT((ISNUMBER(A2:A100))*(B2:B100)).

Does SUMIF work with dates that are not empty?
Yes, dates are numbers, so “<>” works. But if you have blank cells formatted as dates, they might appear as 0 or 1/0/1900; use =SUMIF(A2:A100, "<>", B2:B100) and ensure blanks are truly empty.

Is there a way to sum non-empty cells without using SUMIF?
Yes, use =SUM(FILTER(B2:B100, A2:A100<>"")) or =SUMPRODUCT((A2:A100<>"")*(B2:B100)). These are more flexible for complex conditions.

Key Takeaways

The core formula =SUMIF(range, "<>", sum_range) is the quickest way to sum values where another column is not empty. Remember that “<>” includes spaces and errors. For stricter control, use SUMPRODUCT or FILTER with TRIM. Always test with a small dataset to verify your results.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.