Sumproduct - to count occasions in a date range

SeliM

New Member
Joined
Aug 10, 2023
Messages
22
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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,218,244
Messages
6,141,357
Members
450,352
Latest member
lohpa

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