gpt4 book ai didi

Count number of line breaks in Google Sheets cell(计算Google Sheets单元格中的换行数)

转载 作者:bug小助手 更新时间:2023-10-28 10:17:33 28 4
gpt4 key购买 nike



Cell value represents a list.
Line breaks in cell represents number of items in list
Need to identify number of items in list.

单元格值表示列表。单元格中的换行符表示需要标识列表中的项数的列表中的项数。


更多回答
优秀答案推荐

Correction

更正


The formula is incorrect for empty cells, use instead:

空单元格的公式不正确,请改用:


= LEN(A1) - LEN(SUBSTITUTE(A1, CHAR(10), "")) + 1 * COUNTA(A1) 

Assuming your cell is A1

假设您的单元格是A1



Turns out this link figured it out:
https://www.extendoffice.com/documents/excel/4785-excel-count-newlines.html

事实证明,这个链接解决了问题:https://www.extendoffice.com/documents/excel/4785-excel-count-newlines.html



Equation where A2 is the cell you want to count the line breaks:

公式,其中A2是要计算换行符的单元格:



=LEN(A2)-LEN(SUBSTITUTE(A2,CHAR(10),""))+1


You can also try with the count formula:

您也可以尝试使用计数公式:


=COUNTA(SPLIT(A1,(CHAR(10))))


Here's a solution that uses COUNTA and does the right thing for empty cells:

下面是一个使用COUNTA并对空单元格执行正确操作的解决方案:


=IF(ISBLANK(A1),0,COUNTA(SPLIT(A1,(CHAR(10)))))

更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com