Answer the question
In order to leave comments, you need to log in
How to count how many times each numeric value occurs in a string?
I have an array with 10 columns and a lot of rows.
I need to count how many times each numeric value occurs in an array.
This is easy to do through COUNTIF , but
the difficulty for me is that if the same values \u200b\u200bare found in one line, then it only needs to be calculated once.
The UNIQUE function works for columns, but when applied to a row, it simply repeats the original row.
Can you suggest how to proceed?
Answer the question
In order to leave comments, you need to log in
Solution:
1) Formula for extracting a list of uniques with sorting:
=SORT(UNIQUE(TRANSPOSE(SPLIT(JOIN(",";A1:J1;A2:J2;A3:J3);","))) )
2) Formula to count the number of occurrences
Initial data in the range A1:J3
You are probably looking for something like
=QUERY(TRANSPOSE(SPLIT(TEXTJOIN("·",TRUE,A1:C6),"·")),
"select Col1, count(Col1) group by Col1")
=ARRAYFORMULA(QUERY(
TRANSPOSE(SPLIT(TEXTJOIN(
"·";
TRUE;
A1:D6*(1=COUNTIFS(A1:D6;A1:D6;COLUMN(A1:D6)*ROW(A1:D6)^0;"<="&COLUMN(A1:D6)*ROW(A1:D6)^0;COLUMN(A1:D6)^0*ROW(A1:D6);COLUMN(A1:D6)^0*ROW(A1:D6)))
);"·"));
"select Col1, count(Col1) group by Col1"
))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question