计算特定范围内的文本和数字值,具有换行符。

huangapple go评论61阅读模式
英文:

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.

sheet Link

=IF(G3&lt;&gt;&quot;&quot;,LEN(TRIM(G3))-LEN(SUBSTITUTE(TRIM(G3),&quot;,&quot;,&quot;&quot;))+1,&quot;0&quot;)+IF(H3&lt;&gt;&quot;&quot;,LEN(TRIM(H3))-LEN(SUBSTITUTE(TRIM(H3),&quot;,&quot;,&quot;&quot;))+1,&quot;&quot;)/2+IF(I3&lt;&gt;&quot;&quot;,LEN(TRIM(I3))-LEN(SUBSTITUTE(TRIM(I3),&quot;,&quot;,&quot;&quot;))+1,&quot;&quot;)/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

计算特定范围内的文本和数字值,具有换行符。

huangapple
  • 本文由 发表于 2023年3月3日 20:00:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75626798.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定