英文:
Count the TEXT and Numeric Values form specific Range with Line Break
问题
我一直在使用以下公式,该公式从特定日期范围计算请假状态,这些日期以文本或数字值的形式提供,但我的公式计算结果是错误的。
我尝试了不同的公式,如LEN(SUBSTITUTE来计算换行符,但都不起作用。我已经附上了一张表供您参考。希望有人可以帮助我。谢谢。
=IF(G3<>"",LEN(TRIM(G3))-LEN(SUBSTITUTE(TRIM(G3),",",""))+1,"0")+IF(H3<>"",LEN(TRIM(H3))-LEN(SUBSTITUTE(TRIM(H3),",",""))+1,"")/2+IF(I3<>"",LEN(TRIM(I3))-LEN(SUBSTITUTE(TRIM(I3),",",""))+1,"")/4
英文:
I have been using below formula which calulcates the Leaves status from the specific range of dates these dates are comes with TEXT or Numeric values and my formula is calculating the results wrong.
I have tried with different formulas like LEN(SUBSTITUTE to count the Line Breaks but nothing is working. I have attached a Sheet for your reference. I hope someone can help me Thanks.
=IF(G3<>"",LEN(TRIM(G3))-LEN(SUBSTITUTE(TRIM(G3),",",""))+1,"0")+IF(H3<>"",LEN(TRIM(H3))-LEN(SUBSTITUTE(TRIM(H3),",",""))+1,"")/2+IF(I3<>"",LEN(TRIM(I3))-LEN(SUBSTITUTE(TRIM(I3),",",""))+1,"")/4
答案1
得分: 1
你可以尝试使用以下公式,结合BYROW和BYCOL:
=BYROW(G3:I, LAMBDA(c, SUM(BYCOL(c, LAMBDA(r, COUNTA(IFERROR(SPLIT(r, CHAR(10), 1))) * INDEX(1:1, 1, COLUMN(r)))))))
=BYROW(J3:L, LAMBDA(c, SUM(BYCOL(c, LAMBDA(r, COUNTA(IFERROR(SPLIT(r, CHAR(10), 1))) * INDEX(1:1, 1, COLUMN(r))))))
PS: 必须更改1/2和1/4,因为它们被视为日期而不是分数。
英文:
You can try with this formula, combining BYROW and BYCOL:
=BYROW(G3:I,LAMBDA(c,SUM(BYCOL(c,LAMBDA(r,COUNTA(IFERROR(SPLIT(r,CHAR(10),1)))*INDEX(1:1,1,COLUMN(r)))))))
=BYROW(J3:L,LAMBDA(c,SUM(BYCOL(c,LAMBDA(r,COUNTA(IFERROR(SPLIT(r,CHAR(10),1)))*INDEX(1:1,1,COLUMN(r)))))))
PS: had to change 1/2 and 1/4 since they were considered as dates instead of fractions
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论