Here I have created SQL Script.that will help you out.
SQL
DECLARE @tblFlats AS TABLE(Id INT,FlatNumber VARCHAR(100))
INSERT INTO @tblFlats VALUES
(1,'1,2,3,4'),
(2,'2'),
(3,'3'),
(4,'5,6,7,8'),
(5,'9'),
(6,'10'),
(7,'11'),
(8,'12'),
(9,'13')
Select SUM(LEN(FlatNumber) - LEN(REPLACE(FlatNumber,',', ''))+1) Result from @tblFlats
Output:
Result
15