AAM111
AAM111

Reputation: 1239

In Google Sheets, how can you find the mode of non-numerical data?

If I want to find the mode of A2:A10, but my values are something like:

Foo
Foo
Bar
Foo
Baz
Bar
Foo
Bar
Foo

, what can I do?

The =MODE() function only takes numerical data, so is there a way to find the most frequent of these values? Thank you!

Upvotes: 11

Views: 14832

Answers (2)

Đức Thanh Nguyễn
Đức Thanh Nguyễn

Reputation: 9365

Try the following formula:

=ArrayFormula(index($A$1:$A$10, mode(match($A$1:$A$10,$A$1:$A$10,0))))

MATCH function will give you the position of each first entry, which is a numerical value and can be used inside MODE function, then we can use INDEX function to extract the value from this list.

Upvotes: 0

user4039065
user4039065

Reputation:

Use a MATCH on a MAX(COUNTIF(...)) to a COUNTIF and pass the row position back to an INDEX.

=index(A2:A10, match(max(countif(A2:A10, A2:A10)), countif(A2:A10, A2:A10), 0))

In the case of a tie in frequency, the first in the list that matches the maximum frequency rate will be returned.

        google-sheets_max_text_frequency

Upvotes: 14

Related Questions