本帖最后由 edwin11891 于 2024-6-1 22:02 编辑
在6楼的基础上,将结果中票面值设置为楼主示例样式,并提供了两种最终方案:
1. 所有面值,计算结果不含时,显示为0,A6:P11区域;
2. 不含的面值,显示为空(楼主示例样式),A17:P22区域。
图中绿色框为上述两种方式,均可作为标准模板随意选用。
(请注意下面公式中的“Y”实际为人民币大写符号,由于放入公式栏系统会出错,暂改为Y)
F3:
- =LEFT(RIGHT(" Y"&ROUND(A1,2)*100,SEQUENCE(,11,11,-1)),1)
复制代码
A6:
- =LET(d,DROP(REDUCE(A1,{100,50,20,10,5,1},LAMBDA(x,y,VSTACK(x,HSTACK(y,QUOTIENT(TAKE(x,-1,-1),y),MOD(TAKE(x,-1,-1),y))))),1,-1),e,DROP(REDUCE("",BYROW(d,LAMBDA(x,PRODUCT(x))),LAMBDA(x,y,VSTACK(x,LEFT(RIGHT(" Y"&y,SEQUENCE(,6,6,-1)),1)))),1),sFace,TAKE(d,,1),sNum,CHOOSECOLS(d,2),nFace,IF(sFace=10,"拾元",TEXT(sFace,"[DBNum2]")&"元"),HSTACK(nFace,sNum,e))
复制代码
I6:
- =LET(d,DROP(REDUCE(MOD(A1,1),{0.5,0.2,0.1,0.01},LAMBDA(x,y,VSTACK(x,HSTACK(y,QUOTIENT(TAKE(x,-1,-1),y),ROUND(MOD(TAKE(x,-1,-1),y),2))))),1,-1),e,DROP(REDUCE("",BYROW(d,LAMBDA(x,PRODUCT(x))),LAMBDA(x,y,VSTACK(x,LEFT(RIGHT(" Y;"&y*100,SEQUENCE(,6,6,-1)),1)))),1),sFace,TAKE(d,,1),sNum,CHOOSECOLS(d,2),nFace,IF(sFace>=0.1,TEXT(RIGHT(INT(sFace*10),1),"[dbnum2]0角;;"),TEXT(RIGHT(INT(sFace*100),1),"[dbnum2]0分;;")),HSTACK(nFace,sNum,e))
复制代码
------------------------------------------------------------------------------------
A17:
- =LET(d,DROP(REDUCE(A1,{100,50,20,10,5,1},LAMBDA(x,y,VSTACK(x,HSTACK(y,QUOTIENT(TAKE(x,-1,-1),y),MOD(TAKE(x,-1,-1),y))))),1,-1),e,DROP(REDUCE("",BYROW(d,LAMBDA(x,PRODUCT(x))),LAMBDA(x,y,VSTACK(x,IF(y=0,MAKEARRAY(1,6,LAMBDA(m,n,"")),LEFT(RIGHT(" Y;"&y,SEQUENCE(,6,6,-1)),1))))),1),sFace,TAKE(d,,1),sNum,CHOOSECOLS(d,2),nFace,IF(sFace=10,"拾元",TEXT(sFace,"[DBNum2]")&"元"),HSTACK(nFace,IF(sNum=0,"",sNum),e))
复制代码
I17:
- =LET(d,DROP(REDUCE(MOD(A1,1),{0.5,0.2,0.1,0.01},LAMBDA(x,y,VSTACK(x,HSTACK(y,QUOTIENT(TAKE(x,-1,-1),y),ROUND(MOD(TAKE(x,-1,-1),y),2))))),1,-1),e,DROP(REDUCE("",BYROW(d,LAMBDA(x,PRODUCT(x))),LAMBDA(x,y,VSTACK(x,IF(y=0,MAKEARRAY(1,6,LAMBDA(m,n,"")),LEFT(RIGHT(" Y;"&y*100,SEQUENCE(,6,6,-1)),1))))),1),sFace,TAKE(d,,1),sNum,CHOOSECOLS(d,2),nFace,IF(sFace>=0.1,TEXT(RIGHT(INT(sFace*10),1),"[dbnum2]0角;;"),TEXT(RIGHT(INT(sFace*100),1),"[dbnum2]0分;;")),HSTACK(nFace,IF(sNum=0,"",sNum),e))
复制代码
|