Reputation: 129
I'm trying to come up with a function to calculate the bi-weekly pay-period in Excel. For example: 7/12/11 through 7/26/2011 I want to return Fridays only, 7/21 and 8/5/2011 for Payday. Thanks for your help!
Upvotes: 4
Views: 57237
Reputation: 237
Create a formula that will generate a biweekly-expected paydate with any input date.
The dates supplied at the top are 15 days apart. Biweeks are 14 days. I am assuming that a biweek is on and between Tue 7/12/2011 & Mon 7/25/2011 and that the expected paydate is supposed to be Friday 8/5/2011. I am also assuming that the biweek pattern repeats indefinitely.
A biweek is 14 consecutive workdays starting on an arbitrary date S and ending on an arbitrary date E. Where S + 13 = E
An Expected Pay Date (EPD) of a biweek is always a certain number of days after E (The end of the biweek ) The EPD is usually a Friday.
=A1-MOD(A1,14)+IF(MOD(A1,14)<10,20,34)
This works by converting every date to the saturday before the input date: A1, this is convenient because the expectated pay date will now always be 20 or 34 days away, the IF formula applies this appropriately.=A1+CHOOSE(MOD(A1,14)+1,20,19,18,17,16,15,14,13,12,11,24,23,22,21)
this formulas works on the same subject, but rather than converting everything to saturday it utilizes the fact that with the biweek definition of all biweeks starting on and including a Tuesday and ending 13 days later on and including a Monday the EPD will always be 11 to 25 days off depending on the day of the week it is. The MOD formula determines what day of the week it is and the CHOOSE formula chooses the appropriate number of days to add (11 to 25).My company actually has a biweek that starts on a Thursday such that the 14th day of the biweek is a Wednesday. The EPD is always 16 days after the end of the biweek Wednesday. An arbitrary Friday that happens to be one of our EPD's is 12/4/2015. With this information the two formulas above can be adjusted:
=A1-MOD(A1,14)+IF(MOD(A1,14)<5,20,34)
again all dates are converted to Saturday, but where it used to be "<10" in the IF formula now it is "<5" because my biweeks end on a Wednesday, instead of a Monday.=A1+CHOOSE(MOD(A1,14)+1,20,19,18,17,16,29,28,27,26,25,24,23,22,21)
same except given my biweek and EPD definition the range is now 16 to 29 days.The First formula is probably easiest for most people to use. To adjust it to fit your date Range you'll have to define figure out four things:
APPLY: =d-MOD(d,14)+IF(MOD(d,14)<w,e,s)
Disclaimer: sorry if the maths are a bit complicated looking, if someone has a easier way of explaining I'm always open to it.
Upvotes: 1
Reputation: 46331
If you have a date in A1 then you can return the next payday on or after that date with this formula
=CEILING(A1+1,14)-1
Assuming paydays are every 2 weeks with one payday being on Friday 26 July 2013
If it's the "alternate" Fridays then switch to this version
=CEILING(A1+8,14)-8
Assumes you are using default 1900 date system
Upvotes: 12