SUMIF Not Blank in Google Sheets: Formula & Fixes

How-to basics · Updated November 23, 2026

To sum values in Google Sheets only when a corresponding cell in another column is not blank, use the SUMIF function with a criterion of "<>" (the “not equal to nothing” operator). The formula is =SUMIF(A2:A10,"<>",B2:B10), which sums all numbers in B2:B10 where the matching cell in A2:A10 is not empty. This directly answers the common question and works in any modern browser version of Google Sheets.

Why the “Not Blank” Criterion Is Tricky

Most people first try =SUMIF(A2:A10,"<>",B2:B10) and expect it to work, but sometimes it returns 0 or skips cells that look empty. The issue is that Google Sheets treats a cell containing a formula that returns an empty string (like ="") as “not blank” for SUMIF purposes, even though it visually appears empty. Similarly, cells with a single space character are not truly blank. The "<>" criterion means “not equal to empty text,” so it includes those pseudo-blank cells. If you need to exclude cells that contain only spaces or zero-length formula results, you must use a different approach, such as SUMIFS with a wildcard or a SUMPRODUCT formula.

How SUMIF Handles Blank Cells

SUMIF evaluates each cell in the range against the criterion. When the criterion is "<>", it checks whether the cell is not equal to an empty string. A truly empty cell (no content, no formula) is equal to an empty string, so it is excluded. A cell with a space character is not equal to an empty string, so it is included. A cell with a formula like =IF(TRUE,"","x") returns an empty string, which is also not equal to an empty string? Actually, it is equal to an empty string, so SUMIF excludes it. Wait—the nuance is that "<>" compares the cell’s value to an empty string. A formula returning "" produces an empty string, so it is treated as blank. However, a cell with a space character is not an empty string, so it is treated as non-blank. To exclude spaces, use =SUMIF(A2:A10,"<>",B2:B10) but first clean the data with TRIM, or use a SUMPRODUCT formula that checks for length.

Step-by-Step: Applying SUMIF Not Blank

Assume you have a list of salespeople in column A (A2:A20) and their sales amounts in column B (B2:B20). You want the total sales for rows where the salesperson name is filled in. Follow these steps:

  • Click on an empty cell, say D2.
  • Type =SUMIF(A2:A20,"<>",B2:B20) and press Enter.
  • The result is the sum of all B values where the corresponding A cell is not empty.

For example, if B2=100, B3=200, B4=300, and A2 has “John”, A3 is empty, A4 has “Mary”, the formula returns 400 (100+300). If you instead wanted to sum where A is blank, use "=" as the criterion: =SUMIF(A2:A20,"=",B2:B20).

Using SUMIFS for Multiple Conditions Including Not Blank

SUMIFS is the multi-condition version. To sum sales where the region (column C) is “West” and the salesperson (column A) is not blank, use =SUMIFS(B2:B20,A2:A20,"<>",C2:C20,"West"). The order is: sum_range first, then criteria_range1, criterion1, criteria_range2, criterion2, etc. Note that SUMIFS also treats space-containing cells as non-blank. If you need to exclude spaces, you can add a helper column with =TRIM(A2) and then use "<>" on that helper column, or use a SUMPRODUCT formula.

Common Problems and Their Fixes

  • Formula returns 0 even though there are visible numbers: Check if the numbers in column B are stored as text. Use =ISNUMBER(B2) to test. Convert text to numbers with the VALUE function or by using Data > Split text to columns.
  • It sums cells that look blank: This happens when cells contain spaces or non-printing characters. Use =TRIM(A2) to clean, or use a SUMPRODUCT formula: =SUMPRODUCT((A2:A20<>"")*(B2:B20))—but this still counts spaces. Better: =SUMPRODUCT((LEN(TRIM(A2:A20))>0)*(B2:B20)).
  • You want to exclude cells with zero-length formulas: Use =SUMPRODUCT((A2:A20<>"")*(B2:B20)) but note that a formula returning "" is equal to an empty string, so it is excluded. If you want to include those, change the criterion to "*" (any text) but that excludes numbers.
  • SUMIF with "<>" does not work across sheets: Use =SUMIF(Sheet2!A2:A10,"<>",Sheet2!B2:B10)—it works fine.

Comparing SUMIF, SUMPRODUCT, and FILTER

SUMIF is the simplest and fastest for a single condition. SUMPRODUCT is more flexible for complex conditions, especially when you need to check for non-empty after trimming. FILTER is a newer function (available in Google Sheets) that returns an array, which you can wrap in SUM: =SUM(FILTER(B2:B20, A2:A20<>"")). This is readable but slower on large datasets. For a single condition, SUMIF is recommended. For multiple conditions or custom logic, SUMPRODUCT is the most powerful. For example, to sum where A is not blank and B is greater than 100, use =SUMPRODUCT((A2:A20<>"")*(B2:B20>100)*B2:B20).

Frequently Asked Questions

Does SUMIF “<>” count cells with formulas that return empty strings? No, a formula returning "" produces an empty string, which is equal to an empty string, so it is treated as blank and excluded. However, a cell with a space character is not an empty string, so it is included. To exclude spaces, use TRIM in a helper column or SUMPRODUCT with LEN(TRIM(…)).

How do I sum if a cell is not blank and also meets another condition? Use SUMIFS with the not-blank criterion as one pair: =SUMIFS(sum_range, criteria_range1, "<>", criteria_range2, "condition"). For example, =SUMIFS(B2:B20, A2:A20, "<>", C2:C20, "West").

Why does my SUMIF return 0 when I use “<>” but I see numbers? The numbers in the sum range might be text. Check with =ISNUMBER(B2). If false, select the column and use Data > Split text to columns or multiply by 1: =SUMIF(A2:A20,"<>",B2:B20*1)—but that doesn’t work in SUMIF. Instead, convert text to numbers using VALUE in a helper column.

Can I use “not blank” with wildcards? Yes, but only for text. The criterion "*" matches any text, but excludes numbers and blanks. To include numbers and text but exclude blanks, use "<>". To exclude blanks and spaces, use "< >"? No, that doesn’t work. Use SUMPRODUCT.

Is there a difference between SUMIF and SUMIFS for not blank? SUMIF is for a single condition; SUMIFS is for multiple. Both use "<>" the same way. SUMIFS requires the sum_range first, while SUMIF has sum_range last. For a single condition, SUMIF is shorter.

What about counting not blank instead of summing? Use COUNTIF with "<>": =COUNTIF(A2:A20,"<>") counts non-empty cells. For counting non-empty in multiple columns, use =COUNTA(A2:A20) but that counts spaces too.

Alternatives for Complex Not-Blank Logic

If your data has leading/trailing spaces or formula-generated empty strings, consider a helper column. In C2, enter =IF(LEN(TRIM(A2))>0, B2, "") and drag down. Then sum column C with =SUM(C2:C20). This is the most reliable method for messy data. Another alternative is the QUERY function: =QUERY(A2:B20, "select sum(B) where A is not null label sum(B) ''"). This treats truly blank cells as null, but spaces are not null, so it still includes spaces. For the most precise control, SUMPRODUCT with LEN and TRIM is the best single-formula solution: =SUMPRODUCT((LEN(TRIM(A2:A20))>0)*(B2:B20)). This sums B only where A has at least one non-space character. Remember that SUMPRODUCT requires ranges of equal size, and it will treat any text in B as 0, so ensure B contains numbers.

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.