Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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?