Dear all,
I have spent my last couple of days unsuccessfully trying to find out an Excel formula hence I am turning to this Forum's wisdom.
NOTE: I installed and tried to use XLS2BB add-in but I cannot bypass the macro-locking.
Based on the start/end dates of an employee, I need to count the number of partial months in which the employee was active during a given reporting period.
1) I have four dates in total as shown in the image below:
- Financial Period Start and End Date;
- Employee Start and End Date.
With a simple IF Formula in D6 and E6, I was able to calculate the number of complete (nor partial) months as follows:
Formula in cell D6:
Formula in cell E6:
The problem arises when the start/end dates of employee or financial reporting does not coincide with the 1st day of the month. If the example above:
* For employee 1, the "Months active within FP2" should be 11.5 instead of 12; and
* For employee 2, the "Months active within FP2" should be 10.17 instead of 11.
I hope I was able to depict my issue correctly. Thanks a lot in advance!
I have spent my last couple of days unsuccessfully trying to find out an Excel formula hence I am turning to this Forum's wisdom.
NOTE: I installed and tried to use XLS2BB add-in but I cannot bypass the macro-locking.
Based on the start/end dates of an employee, I need to count the number of partial months in which the employee was active during a given reporting period.
1) I have four dates in total as shown in the image below:
- Financial Period Start and End Date;
- Employee Start and End Date.
With a simple IF Formula in D6 and E6, I was able to calculate the number of complete (nor partial) months as follows:
Formula in cell D6:
Excel Formula:
=IFERROR(IF(B6<$B$2,DATEDIF($B$2,IF(C6<$C$2,C6,$C$2),"m")+1,DATEDIF(B6,IF(C6<$C$2,C6,$C$2),"m")+1),0)
Excel Formula:
=IFERROR(IF(B6<$B$3,DATEDIF($B$3,IF(C6<$C$3,C6,$C$3),"m")+1,DATEDIF(B6,IF(C6<$C$3,C6,$C$3),"m")+1),0)
The problem arises when the start/end dates of employee or financial reporting does not coincide with the 1st day of the month. If the example above:
* For employee 1, the "Months active within FP2" should be 11.5 instead of 12; and
* For employee 2, the "Months active within FP2" should be 10.17 instead of 11.
I hope I was able to depict my issue correctly. Thanks a lot in advance!