Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
SureshUK
Contributor II
Contributor II

Finding maximum occurrence of a character in a string

Hi,

Is there a way of finding maximum occurrence of a character in a given string?

Example: In the string "RAGR", "R" has occurred twice.

The string will always have just one character occurring multiple times and there won't be any stalemate.

Thanks.

13 Replies
sunny_talwar

Didn't you mention that there will only be one character repeating?

"The string will always have just one character occurring multiple times and there won't be any stalemate."


Checking now

sunny_talwar

This will work for numbers, but not text

=Left(Trim(Concat(DISTINCT Mid(Field, ValueLoop(1, 100), 1), '', -(SubStringCount(Field, Mid(Field, ValueLoop(1, 100), 1))*100 + Alt(Mid(Field, ValueLoop(1, 100), 1), 0)))), 1)

SureshUK
Contributor II
Contributor II
Author

Thanks Sunny. This works!

sunny_talwar

Super, but remember this may or may not work for string character.... that might need some more modifications. Would you need that?