Can function be applied to range in sumif prior to criteria check?

C

Cheese_whiz

Hi all,

I have a range of dates I'm using for the first argument in a sumif
function. I need to convert those dates to a single month number (one for
each date) prior to running the criteria check found in the second argument
of the sumif function.

Is that possible?

tahnks,
CW
 
B

Bob Phillips

No, use SUMPRODUCT

=SUMPRODUCT(--(MONTH(date_range)=1),--(date_range<>""),amount_range)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
M

Max

Think you could try sumproduct to get the result directly

Assuming real dates in A2 down, values to be summed in B2 down
then in say, C2, something like this, either:
=SUMPRODUCT((MONTH(A2:A10)=2)*B2:B10)
or
=SUMPRODUCT((TEXT(A2:A10,"mmmyy")="Feb08")*B2:B10)
the latter sums col B for dates falling within a particular month-yr
 
C

Cheese_whiz

Thanks for the replies!

I finally got it going by using Bob's code as a starting point.

Thanks again for all the replies,
CW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top