Big Sumifs, looking inside month range?

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
790
Office Version
  1. 365
Platform
  1. Windows
Hi hi hello hi.

Running into a problem where I'm looking for commission values on bookings made for a product in a newspaper, on a timeframe.

Let's say we've sold a product in Paper "Sheffield Times" and we placed the advert in the Sheffield Times on the 4th February (04/02/2019)

I'm then looking in a file called the Allocation Extracts for a booking made that matches the paper and the time of advertisement.

However, we are getting issues because of variances in advert placement times from one sheet to another, and we can't sort these issues as they're already "committed" so to speak.

What I have is a formula that looks like this, though I've removed large parts of it for ease:

VBA Code:
=SUMIFS('[Allocation Extracts.xlsm]Om'!$F:$F,'[Allocation Extracts.xlsm]Om'!$G:$G,$B4,'[Allocation Extracts.xlsm]Om'!$B:$B,$D4)/COUNTIFS($B:$B,$B4,$D:$D,$D4)

We are summing column F (commission) in sheet OM, based on whether G = Paper Name and B = Date.

It's that date I want to change. Right now, it's looking at serial 43472, which is 07/01/2019, but what if I want it to look at: "XX/01/2019" or, any day in the given month?

Is there any way to do this? Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
The main idea if you want to use SUMIFS is to look for the start and end dates of the month. Use EOMONTH to find those dates based on your date. Try:

Book1
ABCD
17/14/2019DateAmt
27/2/20191
3Sum8/2/20192
4106/1/20193
57/8/20194
67/31/20195
74/4/20186
Sheet3
Cell Formulas
RangeFormula
A4A4=SUMIFS(D2:D7,C2:C7,">="&EOMONTH(A1,-1)+1,C2:C7,"<="&EOMONTH(A1,0))


You can also use SUMPRODUCT with the MONTH function, but this should work for you.
 
Upvote 0
Can a mod delete this please? I figured it out because I overlooked just making the criteria match value "">="&Date(2019,Month(B1252),1) etc etc

But it's not producing the result I wanted as the criteria is now too narrow! Oh well.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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