Sum Numbers based on Criteria next Column

After reading this article you will be able to sum the number of the next column after excluding blank cells.

Adding numbers referencing to the next column where some cells are empty and remaining fills with text, number, dates, etc.

Query

We have three columns, starting with Receipt numbers, Sales and Receiving date. Our task is to add all sales (column C) with the received date (column D) and ignoring cells that are being empty. 

Formula to implement:

=SUMIF(D3:D12,”<>”,C3:C12)

Download Your Example Excel File

Sum numbers excluding empty cells
Add all values with non empty cells

Function applicable:

    • SUMIF – Excel categorizes SUMIF function under Math functions. This function adds all numbers in a range of cells that meet specific criteria. We can apply criteria to dates, numbers and text using logical operators (>, <, <>, =) and wildcards (*, ?) for partial matching.
Sum not empty cells

Syntex =SUMIF (range, criteria, [sum_ range])

The SUMIF formula in Excel takes three arguments out of which one is optional. The function follows a format where a user needs to enter range and criteria while sum_range is optional.

Range: A lookup range to apply criteria.

Criteria: The criteria that must satisfy in the given Range.

Sum_ range [Optional]: The range of cells to add if it satisfies the condition.

Formula explanation (Step by Step)

You can also debug formula using shortcut F9 or Evaluate the formula step wise.

Let’s break the formula into multiple small steps to understand its application.

First formula:

=IF(D3:D12,”<>”,C3:C12)

Note: SUMIF formula is a combination of SUM and IF formula.

Step 1:  IF(D3:D12,”<>”) 

Result: (43591;0;43626;0;43666;43702;0;0;43689;0)

It will return all values that have dates (non-empty) from range D3 to D12 based on criteria <> (not equal) i.e. dates that are being shown and return ‘0‘ if cells are empty.

Second formula:

=SUMIF(D3:D12,”<>”,C3:C12)

Integrate first formula in step 2

Step 2: SUMIF(D3:D12,”<>”,C3:C12)

Result: 54693

(10606+ 10998 +10039+11509+11541)

Excel will only add those numbers that are with any values (Criteria) in the D column in the range C3 to C12.

You can also add all values that are with empty cells by just changing the criteria i.e. “”(empty) in the place of “<>”(not equal) by entering date.