Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Try this
=Left(Trim(Concat(DISTINCT Mid(Field, ValueLoop(1, 100), 1), '', -SubStringCount(Field, Mid(Field, ValueLoop(1, 100), 1)))), 1)
Hi
Is the string always 4 characters in length ?
Hi Raj
Substringcount function see example below:
HospitalName | =substringcount([HospitalName], 'I') |
Aberdeen Royal Infirmary | 1 |
Aberdeen Royal Infirmary (T3) | 1 |
Addenbrookes (T3) | 0 |
Please mark and helpful and correct if so...
Thanks
Is this something you need in script or front end?
Need not be 4 digit and it can vary
In the front end
I get this but how do I find out the maximum with out many IF conditions?
Try this
=Left(Trim(Concat(DISTINCT Mid(Field, ValueLoop(1, 100), 1), '', -SubStringCount(Field, Mid(Field, ValueLoop(1, 100), 1)))), 1)
This looks to me working! Thanks for your help.
Hi Sunny,
I have an additional requirement on this. When two characters have same frequency, I would like it to be sorted by descending.
Example: for the value 44223, I would like the outcome to be 4 not 2.