aolz.blogg.se

Excel subtract dates formula
Excel subtract dates formula







excel subtract dates formula

If the corresponding months are not the same, the accounting months hasn't started yet. The logic to exclude the last month if the end date hasn't reached the fourth business day is via the following condition: MONTH(A2)=MONTH(WORKDAY(A2,-4) Or using LET to avoid repetition: =LET(months, DATEDIF(B2,A2,"M"), IF(MONTH(A2)=MONTH(WORKDAY(A2,-4)), months, months-1))ĭATEDIF can calculate the number of complete months between two dates via second input argument: unit in months ( M).

excel subtract dates formula

In C2 the following formula and then extend it down: =IF(MONTH(A2)=MONTH(WORKDAY(A2,-4)),ĭATEDIF(B2,A2,"M"), DATEDIF(B2,A2,"M")-1) I think you can use a different approach.









Excel subtract dates formula