Comfortable Goose
Comfortable Goose

Reputation: 11

How can I use SUMIF to sum based on date?

I was trying to use the =SUMIF function to calculate the expected expenses to date. In other words, only values in the Amount column should be added to the total if the respective value in the Date column is less than the value labelled Today's Date.

Your help is appreciated. enter image description here

Upvotes: 1

Views: 1636

Answers (1)

Sebastian Smiley
Sebastian Smiley

Reputation: 1099

Answer

The following formula should produce the result you desire:

=SUMIF(D5:D13,"<="&D2,F5:F13)

Explanation

The issue was that you did not have an ampersand between "<=" and D2. The second argument of a =SUMIF must be a string, but Google Sheets does not know to interpret the value in D2 as a string by default. Thus, you get a formula parse error. By concatenating D2 with <= as a string, the =SUMIF's second argument will now be a single string and the formula will function correctly.

Functions used:

Upvotes: 1

Related Questions