Modify SumIf formula

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
921
Office Version
  1. 365
Platform
  1. Windows
I have this SumIf formula that Sums column G if the dates in Column F Match the previous day:

=SUMIF('WorkOrder Search Export'!G2:G1000000, TODAY()-1, 'WorkOrder Search Export'!F2:F1000000)

How would I modify this formula to do it for the current month and previous month

Date format in column F is: 2019-09-25

Thank you for your help in modifying this formula

Carla
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Willow,

Adjust ranges as needed;

Yesterday
=SUMPRODUCT(('Workorder Search Export'!$F$2:$F$13=TODAY()-1)*'Workorder Search Export'!$G$2:$G$13)

Current Month
=SUMIFS('Workorder Search Export'!$G$2:$G$13,'Workorder Search Export'!$F$2:$F$13,">="&EOMONTH(TODAY(),-1)+1,'Workorder Search Export'!$F$2:$F$13,"<="&EOMONTH(TODAY(),0))

Previous Month
=SUMIFS('Workorder Search Export'!$G$2:$G$13,'Workorder Search Export'!$F$2:$F$13,">="&EOMONTH(TODAY(),-2)+1,'Workorder Search Export'!$F$2:$F$13,"<="&EOMONTH(TODAY(),-1))
 
Upvote 0
Are you really using anything like a million rows? I would try to restrict that row range in your formulas if possible.

Apart from the above comment, I would stick with your current SUMIF rather than SUMPRODUCT for the 'yesterday' question, especially if you do have a very large data set.

For 'This Month', I think RasGhul has accidentally swapped the F/G columns & it can be simplified ever so slightly. Again adjust ranges to suit.
=SUMIFS('WorkOrder Search Export'!$F$2:$F$35,'WorkOrder Search Export'!$G$2:$G$35,">"&EOMONTH(TODAY(),-1),'WorkOrder Search Export'!$G$2:$G$35,"<="&EOMONTH(TODAY(),0))

'Last Month', similar comments
=SUMIFS('WorkOrder Search Export'!$F$2:$F$35,'WorkOrder Search Export'!$G$2:$G$35,">"&EOMONTH(TODAY(),-2),'WorkOrder Search Export'!$G$2:$G$35,"<="&EOMONTH(TODAY(),-1))
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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