您的公式有问题:
1、负值只是在结果前加一个“-”
2、小数结果显示值都是减1后的值,就是说,0.33转换后为二角二分。
百度到的公式能实现:
="大写金额:"&IF(TRIM(B1)="","",IF(B1=0,"","人民币"&IF(B1<0,"负",)&IF(INT(B1),TEXT(INT(ABS(B1)),"[dbnum2]")&"元",)&IF(INT(ABS(B1)*10)-INT(ABS(B1))*10,TEXT(INT(ABS(B1)*10)-INT(ABS(B1))*10,"[dbnum2]")&"角",IF(INT(ABS(B1))=ABS(B1),,IF(ABS(B1)<0.1,,"零")))&IF(ROUND(ABS(B1)*100-INT(ABS(B1)*10)*10,),TEXT(ROUND(ABS(B1)*100-INT(ABS(B1)*10)*10,),"[dbnum2]")&"分","整")))
但这个公式仍有问题:显示值会在人民币后面、数值前面加一个0(这个问题在EXCEL中没有,在活字格里就有),检查后发现是if函数判定正负时,负值显示“负”,正值默认显示一个0,所以在IF函数后面加上条件不成立显示结果空值,即加上“”即可。
所以修改后正确能用的函数为:
="大写金额:"&IF(TRIM(B1)="","",IF(B1=0,"","人民币"&IF(B1<0,"负","")&IF(INT(B1),TEXT(INT(ABS(B1)),"[dbnum2]")&"元",)&IF(INT(ABS(B1)*10)-INT(ABS(B1))*10,TEXT(INT(ABS(B1)*10)-INT(ABS(B1))*10,"[dbnum2]")&"角",IF(INT(ABS(B1))=ABS(B1),,IF(ABS(B1)<0.1,,"零")))&IF(ROUND(ABS(B1)*100-INT(ABS(B1)*10)*10,),TEXT(ROUND(ABS(B1)*100-INT(ABS(B1)*10)*10,),"[dbnum2]")&"分","整")))
*以上函数中B1为源单元格。
图中上面一行为您的公式结果,下面一行为我这个公式的结果。
|