sssssiiiiimon
Design Dabbler

If, And, Or

Hi

I am some trouble with a formula. I want to configure a text box to have a specific amount of numbers when another choice field is used. So far I have the below but its not working.

 

When the Entity choice field is populated I want the account number to have a specific amount of digits

 

Any help would be much appreciated

 

=IF(OR(AND(Entity="Entity 1",LEN(AccountNumber=14),AND(Entity="Entity 2",LEN(AccountNumber=11),AND(Entity="Entity 3",LEN(AccountNumber=8),AND(Entity="Entity 4",LEN(AccountNumber=8)))))),"Valid","Invalid")

0 Kudos
Reply
2 Replies
ethurber
Cloud Wanderer

Re: If, And, Or

Hi.

try this one

if((Entity == "Entity1" && lenght(AccountNumber) == 14) || (Entity == "Entity2" && length(AccountNumber) == 11) || (Entity == "Entity3" && length(AccountNumber) == 😎 || (Entity == "Entity4" && length(AccountNumber) == 8), "Valid", "Invalid")

 

If you don't know, "&&" is AND; "||" is OR; == is EQUAL TO

Hope this helps

0 Kudos
Reply
ethurber
Cloud Wanderer

Re: If, And, Or

Update:

If you are going to use this with a validation rule, this is what it should be:

 

(Entity == "Entity1" && lenght(AccountNumber) != 14) || (Entity == "Entity2" && length(AccountNumber) != 11) || (Entity == "Entity3" && length(AccountNumber) != 😎 || (Entity == "Entity4" && length(AccountNumber) != 😎

0 Kudos
Reply