Count days between to Table Ranges that falls in SLA intervals

Nicha

New Member
Joined
Feb 10, 2023
Messages
48
Office Version
  1. 2016
Platform
  1. Windows
Hi Mr. Excel members,

Considering the Projects Table below, I need to count the number of projects whose difference, in calendar days, falls within the SLA Table intervals, without having to use the [Days] Column as support. The [Days] calculation is considering two premises:

  1. If [End_Date] is not Valid Date (i.e. it is < 0 or empty), consider Today's date (Today()).
  2. the calculation includes the limits of the intervals; therefore, if [Start_Date] equals [End_Date], the result must be 1; (hence adding 1 [+1] in the formula).
Posts.xlsx
BCDEFGHIJKL
2Count days between to Table Ranges that falls in SLA intervals
3
4When not valid End_Date consider Today()SLA's Board - hand filled
5being the same date, it returns 1 day<=1>1 and <=3>3 and <=5>5
6StatusStart_DateEnd_DateDaysDD+3D+5D>5Total
7Pending2024-09-0229Pending01034
8Pending2024-09-292Completed12126
9Completed2024-09-052024-09-06210
10Pending2024-09-2011
11Completed2024-09-122024-09-121With FormulasDD+3D+5D>5Total
12Completed2024-09-162024-09-2611Pending01034
13Pending2024-09-2011Completed12126
14Completed2024-09-092024-09-15710
15Completed2024-09-112024-09-144
16Completed2024-09-152024-09-162
Sheet1
Cell Formulas
RangeFormula
L12:L13,L7:L8L7=SUM(H7:K7)
L9,L14L9=SUM(L7:L8)
H12H12=COUNTIFS(Table1[Status],"Pending",Table1[Days],"<=1")
I12I12=COUNTIFS(Table1[Status],"Pending",Table1[Days],">1",Table1[Days],"<=3")
J12J12=COUNTIFS(Table1[Status],"Pending",Table1[Days],">3",Table1[Days],"<=5")
K12K12=COUNTIFS(Table1[Status],"Pending",Table1[Days],">5")
H13H13=COUNTIFS(Table1[Status],"Completed",Table1[Days],"<=1")
I13I13=COUNTIFS(Table1[Status],"Completed",Table1[Days],">1",Table1[Days],"<=3")
J13J13=COUNTIFS(Table1[Status],"Completed",Table1[Days],">3",Table1[Days],"<=5")
K13K13=COUNTIFS(Table1[Status],"Completed",Table1[Days],">5")
E7:E16E7=IF(OR(DAYS(D7,C7)<0,NOT(ISNUMBER([@[End_Date]]))),DAYS(TODAY(),C7)+1,DAYS(D7,C7)+1)


I need to get the formulas from [H12 to K13] to be able to perform the calculation without the help of the [Days] column of the Projects table.

Thank you in advance.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Does this work for your version of Excel? It should but I'm not sure if the dynamic arrays in 365 are giving me a false sense of security!
Note the formulas are array formulas and need to be entered with CTRL+SHIFT+ENTER.

Book1
ABCDEFGHIJK
1
2Count days between to Table Ranges that falls in SLA intervals
3
4SLA's Board - hand filled
5<=1>1 and <=3>3 and <=5>5
6StatusStart_DateEnd_DateDD+3D+5D>5Total
7Pending3/09/2024Pending01034
8Pending30/09/2024Completed12126
9Completed5/09/20246/09/202410
10Pending21/09/2024
11Completed13/09/202413/09/2024With FormulasDD+3D+5D>5Total
12Completed17/09/202427/09/2024Pending01034
13Pending21/09/2024Completed12126
14Completed10/09/202416/09/202410
15Completed12/09/202415/09/2024
16Completed16/09/202417/09/2024
Sheet13
Cell Formulas
RangeFormula
K7:K8,K12:K13K7=SUM(G7:J7)
K9,K14K9=SUM(K7:K8)
G12:G13G12=SUM((Table1[Status]=$F12)*((IF(Table1[End_Date]="",TODAY(),Table1[End_Date])-Table1[Start_Date]+1)<=1))
H12:H13H12=SUM((Table1[Status]=$F12)*((IF(Table1[End_Date]="",TODAY(),Table1[End_Date])-Table1[Start_Date]+1)>1)*((IF(Table1[End_Date]="",TODAY(),Table1[End_Date])-Table1[Start_Date]+1)<=3))
I12:I13I12=SUM((Table1[Status]=$F12)*((IF(Table1[End_Date]="",TODAY(),Table1[End_Date])-Table1[Start_Date]+1)>3)*((IF(Table1[End_Date]="",TODAY(),Table1[End_Date])-Table1[Start_Date]+1)<=5))
J12:J13J12=SUM((Table1[Status]=$F12)*((IF(Table1[End_Date]="",TODAY(),Table1[End_Date])-Table1[Start_Date]+1)>5))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution
Hi @myall_blues, thank you very much.
Your "Array" formulas work very well on my Excel 2016.

I know that opting to use a solution through the CountIFs function, would probably be much more complex. But do you think that using SUMPRODUCT() would also work? If so; could you show me, please, how the formulas in [G12] and [H12] would be?

Thank you once more.
 
Upvote 0
There might be a way but I wasn’t able to figure it out. I started out trying to use SUMPRODUCT as it is my normal goto for earlier versions, but in this case I couldn’t work out how to implement the IF function inside the SUMPRODUCT and had to go back to a normal array formula.
 
Upvote 0
There might be a way but I wasn’t able to figure it out. I started out trying to use SUMPRODUCT as it is my normal goto for earlier versions, but in this case I couldn’t work out how to implement the IF function inside the SUMPRODUCT and had to go back to a normal array formula.
Ok. My best to you.

I'll wait for someone to presente some other Aproach. I'm saying that because the Main Table has more than 40.000 lines. But if no one will not another proposal I'll close with your's.

My best regards @myall_blues
 
Upvote 0

Forum statistics

Threads
1,223,878
Messages
6,175,141
Members
452,615
Latest member
bogeys2birdies

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