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)))))
更多回答
我是一名优秀的程序员,十分优秀!