a sumifs statement that is within a date range?

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
846
Office Version
  1. 2013
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD]Order Date[/TD]
[TD]Type[/TD]
[TD]Order Status[/TD]
[TD]Cost[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2019-07-01[/TD]
[TD]Bulk[/TD]
[TD]Completed[/TD]
[TD]$5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2019-07-09[/TD]
[TD]Parcel[/TD]
[TD]Shipped[/TD]
[TD]$7[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


I need to figure out the weekly shipping costs for Parcel packages. At the moment I'm doing it manually because I can't figure out how to write a sumif statement with a range of dates.

This sheet has about 100K rows, so it's quite extensive. I want to see everything for 7 days, week ending Sun, that is Type = Parcel, Order Status = Completed, and I want the total Cost for that.

Can anyone advise?

Thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Maybe this


Excel 2013/2016
ABCDEFGH
1Order DateTypeOrder StatusCoststart dateend date
21/07/2019BulkCompleted$527/09/20196/11/2019
39/07/2019ParcelShipped$7
417/07/2019BulkCompleted$9
525/07/2019Parcelcompleted$1166
62/08/2019BulkCompleted$13
710/08/2019ParcelShipped$15
818/08/2019BulkCompleted$17
926/08/2019ParcelShipped$19
103/09/2019BulkCompleted$21
1111/09/2019ParcelShipped$23
1219/09/2019BulkCompleted$25
1327/09/2019ParcelShipped$27
145/10/2019BulkCompleted$29
1513/10/2019Parcelcompleted$31
1621/10/2019BulkCompleted$33
1729/10/2019Parcelcompleted$35
186/11/2019BulkCompleted$37
1914/11/2019ParcelShipped$39
2022/11/2019BulkCompleted$41
2130/11/2019ParcelShipped$43
228/12/2019BulkCompleted$45
Sheet1
Cell Formulas
RangeFormula
G5=SUMPRODUCT(--(C2:C22="Completed")*(B2:B22="Parcel")*(A2:A22>=G2)*(A2:A22<=H2)*D2:D22)
 
Upvote 0
I guess if you wanted to go a step further you could create a couple of dropdowns for Status and type


Excel 2013/2016
ABCDEFGHIJ
1Order DateTypeOrder StatusCoststart dateend dateTypeStatus
21/07/2019BulkCompleted$525/07/201925/07/2019ParcelCompleted
39/07/2019ParcelShipped$7
417/07/2019BulkCompleted$9
525/07/2019Parcelcompleted$11$ 11.00
62/08/2019BulkCompleted$13
710/08/2019ParcelShipped$15
818/08/2019BulkCompleted$17
926/08/2019ParcelShipped$19
103/09/2019BulkCompleted$21
1111/09/2019ParcelShipped$23
1219/09/2019BulkCompleted$25
1327/09/2019ParcelShipped$27
145/10/2019BulkCompleted$29
1513/10/2019Parcelcompleted$31
1621/10/2019BulkCompleted$33
1729/10/2019Parcelcompleted$35
186/11/2019BulkCompleted$37
1914/11/2019ParcelShipped$39
2022/11/2019BulkCompleted$41
2130/11/2019ParcelShipped$43
228/12/2019BulkCompleted$45
Sheet1
Cell Formulas
RangeFormula
G5=SUMPRODUCT(--(C2:C22=J2)*(B2:B22=I2)*(A2:A22>=G2)*(A2:A22<=H2)*D2:D22)
 
Upvote 0
Maybe this

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G5[/TH]
[TD="align: left"]=SUMPRODUCT(--(C2:C22="Completed")*(B2:B22="Parcel")*(A2:A22>=G2)*(A2:A22<=H2)*D2:D22)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Great, thanks! I'm not that all that familiar with sumproduct yet but it seems fairly self-explanatory, at least in this case. Why is there a "--" before?


I guess if you wanted to go a step further you could create a couple of dropdowns for Status and type

I'm sorry I didn't follow?
 
Upvote 0
If you created dropdown lists in Col I and J you would be able to input any type and / or status and return the result !!
As for the "--", see here for further explanations

Ahh!! Didn't think of that, thanks! In your previous message I didn't catch the change in the variable, from writing "Parcel" to I2.

My computer goes by M/D/Y. I created a bunch of dates to test this formula and it works - but is there an easier way to change a range of d/m/y formulas to m/d/y?
 
Upvote 0
One way to try...


1. Select the entire dataset and sort the Date column in ascending order

2. Select the column of dates and go to Data > Text to columns > Next > Next > Date > MDY > Finish
 
Upvote 0
Didn't work. No problem, thanks for trying!

One way to try...


1. Select the entire dataset and sort the Date column in ascending order

2. Select the column of dates and go to Data > Text to columns > Next > Next > Date > MDY > Finish
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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