Sumproduct with Date Calculation

KL28

New Member
Joined
Dec 18, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I am trying (without success) to use either Countifs or Sumproduct to count how many cancellations were made with less than 48 hours notice.

So, here Status = Cancelled and Start Date >= 01/11/2022 and Start Date <= 30/11/22 AND where the difference in start date and start time and cancellation date and cancellation time is less than 48 hours.

In the example below, I would expect the result to be 5.



Monthly_Dashboard - Peelhouse.xlsm
ABCDEFGHI
1Start DateStart TimeIDStatusCancelled DateCancelled TimeCriteria
213/10/202209:00:002355Cancelled12/10/202209:47:3401/11/2022
318/10/202209:00:001799Completed30/11/2022
421/10/202209:55:007791CompletedCancelled
501/11/202210:00:007445Did not attend
601/11/202210:00:00147Cancelled21/07/202211:06:29
701/11/202210:00:00490Cancelled23/10/202214:49:00
801/11/202210:25:00537Cancelled29/10/202213:03:19
902/11/202210:30:007445Did not attend
1003/11/202210:30:006253Completed
1104/11/202210:30:007737Cancelled04/11/202209:23:23
1205/11/202211:00:002854Cancelled05/11/202209:41:19
1306/11/202212:15:00510Completed
1406/11/202212:30:007441Cancelled10/10/202216:10:49
1507/11/202212:40:00510Completed
1609/11/202212:40:005166Cancelled09/11/202209:39:03
1711/11/202214:00:003166Completed
1812/11/202214:30:005314Cancelled05/09/202216:01:31
Sheet2
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I'm getting three. Your first two red cancelled - one is in Oct, the other is more than 2 days early.
Excel Formula:
=SUMPRODUCT(--(D2:D18="Cancelled"),--((A2:A18+B2:B18)<(E2:E18+F2:F18+2)),--(A2:A18>=I2),--(A2:A18<=I3))
 
Upvote 0
Solution
=SUMPRODUCT(--(D2:D18="Cancelled"),--((A2:A18+B2:B18)<(E2:E18+F2:F18+2)),--(A2:A18>=I2),--(A2:A18<=I3))

Great, thank you so much. Apolgies, I meant I was expecting 3...got carried away!
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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