0

I have a simple custom list with multiple line column. I need to get count in each multi line column of the list item. (not word count)

As of now, I am exporting the list to excel and by using excel formula, getting the line count in each cell.

Is this possible in SharePoint list itself with a separate count column?

0

I don't think we can accomplish this with OOTB feature. By looking into excel formula, I was hoping to accomplish this with JSON column formatting. However, the issue is replace() function replaces only the first occurrence of '\n'. You can repeat replace() function though if you know the expected max line count, but will not be reliable.

You may try using MS Flow/Power Automate to accomplish this.

Excel Formula:

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

JSON Column Formatting:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=indexOf([$Multiline] + '^', '^') - indexOf(replace([$Multiline], '\n', '') + '^', '^') + 1"

}

However, you can repeat replace() function to a known max number like below to accomplish your goal. But the result count might not be accurate if the actual line number is > then the number of times replace() used in the JSON.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=indexOf([$Multiline] + '^', '^') - indexOf(replace(replace(replace(replace(replace(replace([$Multiline], '\n', ''), '\n', ''), '\n', ''), '\n', ''), '\n',''), '\n','') + '^', '^') + 1"
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.