EXCEL表格怎样用函数公式实现租期及租金的自动计算? 知道起租日及结束日,自动计算租期。知道租?
如下图,C2的公式如下并下拉:
=IF(DATEDIF(A2,B2,"YM")=0,IF(DATEDIF(A2,B2,"D")=0,"",DATEDIF(A2,B2,"D")&"天"),DATEDIF(A2,B2,"YM")&IF(DATEDIF(A2,B2,"MD")=0,"个月整","个月"&DATEDIF(A2,B2,"MD")&"天"))
E2的公式如下并下拉:
=IF(DATEDIF(A2,B2,"YM")=0,--LEFT(D2,LEN(D2)-2),LEFT(D2,LEN(D2)-2)*DATEDIF(A2,B2,"YM")+LEFT(D2,LEN(D2)-2)/DAY(EOMONTH(B2,0))*DATEDIF(A2,B2,"MD"))