Calculating number of days to accrue in a pay period

superskid

Board Regular
Joined
Aug 25, 2006
Messages
160
I have a payroll spreadsheet that I use to calculate my payroll accrual JE when a pay period goes over a month end. In one cell B4 I have the start date of the period (2/24/2014) and in cell B5 I have the end date of the period (3/9/2014).

Because this JE will get posted in March, I need to post an accrual in February for the February days. In this case 5 (24th - 28th inclusive)

I would like a formula that can automatically calculate the number of days to accrue if a payroll crosses over a month end. So basically it has to figure out in the range provided how many days belong to the previous month. If none then no accrual.

I've tried a few things but I'm not so good with the date formulas.

Thanks,
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
=if(month(today())=month($b$4),0,eomonth($b$4,0)-$b$4+1)

Is the today part of the formula going to mess things up if I am behind on posting? Let's say I am just posting the first payroll in February and there are January days to accrue, but the current month is March?
 
Upvote 0
you mentioned previous month in your question thats why i used today :)


behind on posting i should speak to your boss ;)
 
Upvote 0
you mentioned previous month in your question thats why i used today :)


behind on posting i should speak to your boss ;)

Hahaha....it was hypothetical, I want to make sure the formula is future proof. Or I guess in this case past proof????
 
Upvote 0

Forum statistics

Threads
1,222,145
Messages
6,164,214
Members
451,881
Latest member
John kaiser

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