SUMPRODUCT with IF

virtuosok

Board Regular
Joined
Sep 2, 2020
Messages
209
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have the following working formula:
Excel Formula:
=SUMPRODUCT((--(IFERROR(MONTH(IWRS001!$Q$2:$Q$1000),0)=9)),--(IFERROR(YEAR(IWRS001!$Q$2:$Q$1000),0)=2020))
How/where can I add a condition please?
Excel Formula:
IF('IWRS001'!D2:D1000,"United States")

It doesn't work the way I thought it should (nor if I replace a comma after "States" by asterisk:
Excel Formula:
=SUMPRODUCT((--('IWRS001'!D2:D1000,"United States"),(IFERROR(MONTH(IWRS001!$Q$2:$Q$1000),0)=9)),--(IFERROR(YEAR(IWRS001!$Q$2:$Q$1000),0)=2020))
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Maybe something like this:
SUMPRODUCT((--(IWRS001!$D$2:$D$1000="United States"),--(IFERROR(MONTH(IWRS001!$Q$2:$Q$1000),0)=9)),--(IFERROR(YEAR(IWRS001!$Q$2:$Q$1000),0)=2020))
 
Upvote 0
Maybe something like this:
SUMPRODUCT((--(IWRS001!$D$2:$D$1000="United States"),--(IFERROR(MONTH(IWRS001!$Q$2:$Q$1000),0)=9)),--(IFERROR(YEAR(IWRS001!$Q$2:$Q$1000),0)=2020))
Apparently Excel doesn't like this formula (neither as a plain formula nor as an array one)... I get a "there's a problem with this formula" error.
 
Upvote 0
Hi,

Try it this way, CSE:

Excel Formula:
=SUMPRODUCT(--($D$2:$D$10="United States"),--(IFERROR(MONTH($Q$2:$Q$10),0)=9),--(IFERROR(YEAR($Q$2:$Q$10),0)=2020))
 
Upvote 0
This also works, without the CSE or IFERRORs:

Excel Formula:
=SUMPRODUCT(--(IWRS001!D2:D1000="United States"),--(TEXT(IWRS001!Q2:Q1000,"mmyyyy")="092020"))
 
Upvote 0
Solution
Thank you all!
Eric W, special thanks for trimming down the formula and allowing me to drop the CSE component!
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top