You need to sign in to do that
Don't have an account?
Lucky
Changing IF Statement to CASE
Hi I want to convert following IF condition to CASE in Formula field. Please Help me out..
IF(( RecordType.Name = "Business Account") && (BillingCountry != "CAN"),Text(1000),IF(( RecordType.Name = "Business Account") && (BillingCountry = "CAN"),Text(1100),IF(( RecordType.Name = "Business Account - UK"),Text(1200),IF(( RecordType.Name = "ETS/WMI") && CONTAINS(OwnerId__r.Profile.Name, "ETS"),Text(1500),IF(( RecordType.Name = "ETS/WMI") && CONTAINS(OwnerId__r.Profile.Name, "WMI"),Text(1501),IF(( RecordType.Name = "Residential Account") && (BillingCountry != "CAN"),Text(1000),IF(( RecordType.Name = "Residential Account") && (BillingCountry = "CAN"),Text(1100),IF(( RecordType.Name = "Residential Account - UK"),Text(1200),null))))))))Thanks in Advance.
I think this is as efficient as you can get:
IF(( RecordType.Name = "Business Account"),IF((BillingCountry != "CAN"), Text(1000), Text(1100)) ,
IF(( RecordType.Name = "Business Account - UK"),Text(1200),
IF(( RecordType.Name = "ETS/WMI") && CONTAINS(OwnerId__r.Profile.Name, "ETS"),Text(1500),
IF(( RecordType.Name = "ETS/WMI") && CONTAINS(OwnerId__r.Profile.Name, "WMI"),Text(1501),
IF(( RecordType.Name = "Residential Account"), IF((BillingCountry != "CAN"), Text(1000), Text(1100)),
IF(( RecordType.Name = "Residential Account - UK"),Text(1200),null))))))))
All Answers
I would focus less on "How do I convert this to a CASE" formula and more on "How can I simplify this formula to use as little logic as possible". From what you posted, you're checking the BillingCountry = "CAN" or != "CAN" in several places, and can probably benefit from some cleanup in that regard. I'd recommend searching for truth tables on google, write a truth table out for your formula, and then you should be able to figure out the if statements you need to simplify your formula.
I think this is as efficient as you can get:
IF(( RecordType.Name = "Business Account"),IF((BillingCountry != "CAN"), Text(1000), Text(1100)) ,
IF(( RecordType.Name = "Business Account - UK"),Text(1200),
IF(( RecordType.Name = "ETS/WMI") && CONTAINS(OwnerId__r.Profile.Name, "ETS"),Text(1500),
IF(( RecordType.Name = "ETS/WMI") && CONTAINS(OwnerId__r.Profile.Name, "WMI"),Text(1501),
IF(( RecordType.Name = "Residential Account"), IF((BillingCountry != "CAN"), Text(1000), Text(1100)),
IF(( RecordType.Name = "Residential Account - UK"),Text(1200),null))))))))
Give this a try: