如果你的工龄是按实际年限计算,使用公式参考
=YEARFRAC(e2,f2,1)
按你说的补偿金计算应该在I2输入:
=(INT(YEARFRAC(E2,F2,1))+IF((YEARFRAC(E2,F2,1)-INT(YEARFRAC(E2,F2,1)))>0.5,1,0.5))*h2
然后下拉。
G2单元格写入公式
=IF(DATEDIF(E2,F2,"y"),DATEDIF(E2,F2,"y")&"年","")&IF(DATEDIF(E2,F2,"ym"),DATEDIF(E2,F2,"ym")&"个月","")
I2单元格写入公式
=H2*DATEDIF(E2,F2,"y")+IF(DATEDIF(E2,F2,"ym")=0,,IF(DATEDIF(E2,F2,"ym")<6,0.5,1))
再设置单元格格式为常规格式
下拉复制公式
用这个计算工龄
=datedif(e2,f2,"y")+if(mod(datedif(e2,f2,"m"),12)<6,0.5,1)