Avatar of steve bartels
steve bartels
 asked on

EXCEL - Sumproduct using AND statement?

First post, let's get to it!

I use a formula like this in my sheet -

=(SUMPRODUCT(--(TEXT(Sales[Date],"mmmm")=E$2),Sales[Total]))


This grabs a number if the value matches my columns month.

My problem is last years data is being added in again for last october, so I need a way to make it check for month and year.

I have many sheets, each for a different stage of business. Lets say I sold a product, I store that sale as 10/25/2016. Then, I have a summary sheet, which uses the sumproduct to retrieve this data later.

How can I change the formula up top to reflect this? I could add the current year somewhere in an open cell.

Open to ideas if there's an easier way using a totally different formula too! Thanks!
Microsoft Excel

Avatar of undefined
Last Comment
Subodh Tiwari (Neeraj)

8/22/2022 - Mon
Ryan Chong

you can try formula:
=(SUMPRODUCT(--(TEXT(Sales[Date],"mmmm yy")=E$2),Sales[Total]))

Open in new window


and make sure E$2 returns something like: October 16 instead.
steve bartels

ASKER
It doesn't work. I'm not sure how you intended to format F2. "November 16". Reformats to Custom "16-Nov"

 Here's a screenshot
ss--2016-10-25-at-08.40.59-.png
Ryan Chong

what if you trying this instead?
=(SUMPRODUCT(--(TEXT(Example[Date],"mmmm yy")=F$1),Example[Total]))

Open in new window

you can also attached a sample here so that we can diagnose the issue for you.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
steve bartels

ASKER
You did it, Subodh Tiwari (Neeraj)! Thank you!!
Subodh Tiwari (Neeraj)

You're welcome Steve! Glad to help.