function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tzuvytzuvy 

How to compare the value of two strings

Hi,

 

I would like to create a formula field that should compare the value of two strings. I need to know which string is bigger in char size. For example fielda= 9.0.0.3 and fieldb=9.3.0.0

 

Fieldb is bigger than fielda how could I write the IF statement in order to compare who is bigger?

 

Thanks

 

tzuvy

Pradeep_NavatarPradeep_Navatar

Try using the formula given below:

 

IF( (LEN(field A)  -  LEN(field B) ) > 0, ‘A is greater’, ’B is greater’)

tzuvytzuvy

Hi,

 

Thanks for the reply. Unfortunately it doesn't work for me, If I do as you suggested 9.3.0.0 is len 7 and 9.0.3.0 is also 7. In this case the formula will say that they are equal when actually 9.3.0.0 is bigger than 9.0.3.0.

 

What I'm looking for  is a way of creating a formula that will act much as the sort function in excel. It should give me the actual string size like when comparing two names to sort them.

 

Do you know how to do it?

 

Thanks

 

Tzuvy