if A1 had the older date date and B1 had the new date then
=DATEDIF(A1,B1,"d")
Excel- days difference between dates
This is perennial trap. The answer lies in if you are counting gross or net
days.
In a simple example, if a person starts work on 1 January and ends work on 2
January, 2 days pay would be due. Calculating the number of days pay by
taking the last day less the first day would result in an underpayment by
one day. It is, therefore, important when calculating gross days to add one
day (i.e. =date2-date1+1)