I am familiar with the SUMPRODUCT function however when introducing multiple sheets and a date problem into the scenario I am getting no success

What I have is:

Sheet 1

B8:B373 - days of the year

D8:D373 - number data

E8:E373 - number data

Sheet 2

B8:B373 - days of the year

D8:D373 - number data

E8:E373 - number data

Sheet 3

H102 - date entered by user

I would like two formulas, one that can sum all data from both sheets for dates in the current month and also for dates in the previous month based on the date in cell H102. These will be placed on Sheet 3.

This was working for me to determine the previous month but not sure if this was on the right path:

Code:

`=TEXT(DATE(YEAR($H$102),IF(MONTH($H$102)-1>0,MONTH($H$102)-1,12),1),"MMMM")`

This got me nothing but errors:

Code:

`=SUM(IF(MONTH('Sheet 1'!$B$8:$B$373)=TEXT(DATE(YEAR($H$102),IF(MONTH($H$102)-1>0,MONTH($H$102)-1,12),1),"MMMM",'Sheet 1'!$D$8:$E$373)))+SUM(IF(MONTH('Sheet 2'!$B$8:$B$373)=TEXT(DATE(YEAR($H$102),IF(MONTH($H$102)-1>0,MONTH($H$102)-1,12),1),"MMMM",'Sheet 2'!$D$8:$E$373)))`