Sumproduct - to count occasions in a date range

SeliM

Board Regular
Joined
Aug 10, 2023
Messages
62
Office Version
  1. 365
Platform
  1. Windows
Good morning,
I have results of surveys covering 3 years.
I have been able to use sumproduct to total occasions for a selected month for a selected year
When I try to then get the number of occasions where the response is entered as "Completed" I get a zero response
Formula: for month and year

=SUMPRODUCT(IF(MONTH(INDIRECT(Lookup!$N$10))=XLOOKUP(K$2,$B$3:$B$14,$A$3:$A$14),1,0),IF(YEAR(INDIRECT(Lookup!$N$10))=K$1,1,0))
Lookup!$N$10 holds the date range
XLOOKUP(K$2,$B$3:$B$14,$A$3:$A$14) is K$2 - month selected, $B$3:$B$14 is the month names range, $A$3:$A$14 is the month number to assist lookup ( June, 6,)
INDIRECT(Lookup!$N$10)) holds the date range, K$1 = selected year

The formula gives me 8 which is correct

If I try to add - IF(INDIRECT(Lookup!$V2)="Completed ",1,0) - to count the number of occasions for June, 2024, where the response in "Completed" I get zero

=SUMPRODUCT(IF(MONTH(INDIRECT(Lookup!$N$10))=XLOOKUP(K$2,$B$3:$B$14,$A$3:$A$14),1,0),IF(YEAR(INDIRECT(Lookup!$N$10))=K$1,1,0,IF(INDIRECT(Lookup!$V2)="Completed ",1,0)))

Would you have advice on what I have wrong is "--( " required (my attempt did not work.

Thanks very much for looking at this for me.
Geoff
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I've tried on a number of occasions to download the add-in but get a message not able in protected mode which I've never solved sadly
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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