I am trying to determine potential liability in an employment case. For each pay period in which work was performed, each employee is due a penalty amount. Even if they only worked a few days, they might have performed work in two different pay periods, so my formula to count how many 14 day periods there are in each employee's term of employment is not accurate enough.

For each employee I need to determine the number of penalties they are owed, thus I need to know how many pay periods in which they performed work.

I have each employee's hire date (Cell D4) and termination date (Cell E4).

The pay period interval is 14 days (Sunday of Week One to Saturday of Week Two).

The start of the penalty period is 11/9/14, which is the first day of the first pay period, and has a date serial number of 41952.

Can a formula be written to yield the number of pay period end dates in a given span of time?

**EDIT**

I know the hire date and termination date for each employee in a set of employees.

The pay periods for these employees are each two weeks (Sunday of Week One through Saturday of Week Two). The entire period for my data set is November 9, 2014 to September 7, 2019. There are 126 pay periods total and the first pay period starts on Sunday Nobember 9, 2014).

Based on the dates of employment, for each employee I need to know in how many of those pay periods they were employed. My formula for determining the number of 14 day periods in each employee's term of employment is as follows:

```
=IF((SUM(D1228-C1228)/14)<=1, "1", ROUNDUP((SUM(D1228-C1228)/14),0))
```

(Column E is hire date, Column F is termination date)

This was not accurately capturing the number of pay periods in which they worked, just the number of two-week periods between hire and term.

** My Solution**
My not so elegant solution is that I created a look up table ("SOL!$G$2:$G$127") and assigned each pay period a number (1 through 126) and used VLOOKUP to grab the number for the pay periods corresponding to hire date and termination date. I then subtracted the lower number from the higher number and added one to account for the starting pay period.

Formulas to grab hire date pay period and term date pay period numbers. Beginning Pay Period Number:

```
=IF(C3>=41952,LOOKUP(2,1/(SOL!$F$2:$F$127<=C3)/(SOL!$G$2:$G$127>=C3),SOL!$H$2:$H$127),1)
```

Ending Pay Period Number:

```
=IF(C3>=41952,LOOKUP(2,1/(SOL!$F$2:$F$127<=C3)/(SOL!$G$2:$G$127>=C3),SOL!$H$2:$H$127),1)
```

Formula for calculating total number of pay periods:

```
=IF(G3=1,0,((G3-F3)+1))
```

It's not pretty, but it works. Would love to know a more simple solution.

`pay period interval is 14 days (Sunday of Week One to Saturday of Week Two).`

considering month`AUGUST`

, Sun of Wk 1 is`08/04/19`

and Sat of Wk 2 is,`08/17/19`

,,start of the penalty period isfor AUGUST 1st day of pay period is the`11/9/14`

, which is thefirst day of the first pay period,`Sunday 08/04/19`

?? – Rajesh S Aug 29 '19 at 9:20