QGIS – Counting Elements in Comma-Separated Strings in Attribute Table

attribute-tablecountfield-calculatorqgisstring

One of my column in an attribute table in QGIS is separated by comma (shown by column "N") and I wanted to count elements in it. The column is a text field string.

enter image description here

Best Answer

Use this expression with field calculator: array_length (string_to_array (N))

enter image description here