I have 2 columns. First column represent the range of rented nights of a room. Second column represent the total number of nights. The numbers can be between 1 and 31. How can I calculate automatically on the second column the count of nights ? Thanks for reading this !
Try using TEXTSPLIT()
& COUNT()
=COUNT(--TEXTSPLIT(A2,{" ",","},,1))
Or,
Or in Google Sheets
as it seems from the screenshot:
=COUNT(SPLIT(A2," ,"))
Another way in Google-Sheets
:
=COUNT(SPLIT(REGEXREPLACE(A2," |,","|"),"|"))
Excel
using TEXTSPLIT()
(In GS
using REGEXREPLACE()
replace delimiters by a |
pipe, the pipe in between two delimiters it denotes OR
)COUNT()
function to count the numbers.