Number of Departure for Current Quarter in between 24 months

netuser

Active Member
Joined
Jun 19, 2015
Messages
420
I have a table with Column A containing Entry date and Column B Departure Date (will be empty if no departure so should be ignored)

I need to find out for the Current Quarter How many departure I had who did not completed 24 months

So if I am in Quarter 2 it should look all departure dates from April 2016 to June 2016 and then calculate the number of months between entry and departure if it is <24 then it will Count

In this example below I have 2 departure in last 24 M in Q1 (row 4 and row 8) and 1 in Q2 Row 6 (note the Row 3 is not counted as it is more than 24 months)

Thanks :)


Excel 2010 32 bit
ABCDE
1EntryDepartureQ12
22012-01-092014-01-13Q21
32012-05-222016-04-11Q30
42015-06-252016-02-28Q40
52012-09-102014-05-09
62015-10-012016-05-13
72012-10-092015-02-01
82015-03-052016-01-18
Nb depart
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Q1 =sumproduct(1*(month(b2:b8) < 4)*(datedif(a2:a8,b2:b8,"m") < 24)*(year(b2:b8)=year(today())))
q2 =sumproduct(1*(month(b2:b8) < 7)*(month(b2:b8) > 3)*(datedif(a2:a8,b2:b8,"m") < 24)*(year(b2:b8)=year(today())))
q3 =sumproduct(1*(month(b2:b8) < 10)*(month(b2:b8) > 6)*(datedif(a2:a8,b2:b8,"m") < 24)*(year(b2:b8)=year(today())))
q4 =sumproduct(1*(month(b2:b8) < 13)*(month(b2:b8) > 9)*(datedif(a2:a8,b2:b8,"m") < 24)*(year(b2:b8)=year(today())))

Please make sure you remove the spaces surrounding the < and > signs
 
Last edited:
Upvote 0
Thanks for the above formulas, it is working great, but only when there is no empty departure date. As mentioned in my OP the departure date wont be always filled (most of the time). So your formula is not working in this case. Could you please look in to it ?



Excel 2010 32 bit
DEFGH
1EntryDepartureQ1#NOMBRE!
22012-01-092014-01-13Q2
32012-05-222016-04-11Q3
42015-06-252016-02-28Q4
52012-09-102014-05-09
62015-10-012016-05-13
72012-10-092015-02-01
82015-03-052016-01-18
92015-10-01
102012-10-09
112015-03-052014-05-09
122012-05-222016-05-13
132015-06-25
142012-09-10
152015-10-012016-04-11
162012-10-092016-02-28
172015-03-052014-05-09
182015-10-012016-05-13
192012-10-09
Nb depart
Cell Formulas
RangeFormula
H1=SUMPRODUCT(1*(MONTH(E2:E60)< 4)*(DATEDIF(D2:D60,E2:E60,"m")< 24)*(YEAR(E2:E60)=YEAR(TODAY())))
 
Upvote 0
You can change the (DATEDIF(D2:D60,E2:E60,"m")<24) to this (DATEDIF(D2:D60,E2:E60+TODAY(),"M")-TODAY()<24).

It should be changed to (DATEDIF(D2:D60,IF(E2:E60 < D2:D60,D2:D60+800,E2:E60),"M") < 24)

You would also need to enter it using Ctrl+Shift+Enter for it to work.
 
Last edited:
Upvote 0
800 as in 800 DAYS. 800 days > than 24 months. I'm basically trying to return a FALSE if there is no departure date.

To do that I am having it check DEPARTURE column with ENTRY column and see if the value is less (a blank cells value = 0), if it is less the DATEDIF function will calculate the later date as the ENTRY DATE + 800, then the elapsed months between those two dates will be checked to see if they < than 24 months. 800 day difference is not (which returns a false and thats what we need). You can change the 800 to 1000 or 801 it doesnt matter as long as those amount of days are more than 24 months. Like 500 will not work as it is less than 24 months and will result in TRUE and hence be counted.

I hope this explanation made sense, I kind of lost myself while typing it out.
 
Last edited:
Upvote 0
Thanks for explanation :)

Now I need to regroup all 4 formulas in 1 Cell so If you have any idea to do It quickly without a big 1 formulas with 4 IF, that will be welcome. Later I will need to put the result of this in a a Variable in VBA to use it for other things.

Thanks :)
 
Upvote 0
Maybe something like this for the formula? It checks to see what quarter we are in today, and counts only the departure dates that are in the same quarter and year as today.

=SUMPRODUCT(1*(ROUNDUP(MONTH(B2:B8)/3,0)=ROUNDUP(MONTH(TODAY())/3,0))*(DATEDIF(A2:A8,IF(B2:B8 < A2:A8,A2:A8+800,B2:B8),"M") < 24)*(YEAR(B2:B8)=YEAR(TODAY())))

Ctrl shift enter
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

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