Felix
Felix

Reputation: 821

How can I SUMIF where the IF evaluates whether a date is between two dates?

UPDATE: The contents of Column K were not, in fact, formatted as numbers all the way through.

Given:

Column F_____Column K_____Column M

3/1/2015_____1____________2/1/2015

2/1/2015_____2____________3/1/2015

2/1/2015_____3____________4/1/2015

where columns F and M are formatted as dates and K as numbers. Column F is not sorted, Column M is. Every date is for the 1st of its month.

I want to populate Column N such that each row sums the elements in column K whose corresponding value in Column F is in the month of Column M.

Tried:

SUMIF($F$2:$F$12500, AND(">="&M2, "<"&M3), $K$2:$K$12500)

Get zeroes across the board. Evaluating whether row 2 Column M and row 1 Column F are equal yields TRUE. What's going on?

Upvotes: 0

Views: 72

Answers (1)

nbayly
nbayly

Reputation: 2167

With the assumption that all dates are the first of the month you don't have to restrict it to being in between the 2 dates on F:F but just rather that the dates has to match M2. With that in mind you can simply do the following:

N2 = SUMIF(F:F,M2,K:K)

This will add all the values in K:K for rows that have the same month (hence exact same date) as M2. Hope I interpreted your question correctly. Regards.

Upvotes: 1

Related Questions