You need to sign in to do that
Don't have an account?
Cara Ringwood
Creating a formula field dependent on a picklist value
I have a picklist for ethnicity sub category, and I am trying to create an Ethnicity formula field which automatically updates depending on the picklist value.
An example of the formula:
IF (Ethnicity_Sub_Category__c>= Vietnamese, "Asian",
IF (Ethnicity_Sub_Category__c>= Asian Other, "Asian"
Error message:
Error: Syntax error. Found 'Asian'
I tried a few other formulas but also received Error: Field Ethnicity_Sub_Category__c is a picklist field. Picklist fields are only supported in certain functions.
Is there a way to do this?
Thanks in advance
An example of the formula:
IF (Ethnicity_Sub_Category__c>= Vietnamese, "Asian",
IF (Ethnicity_Sub_Category__c>= Asian Other, "Asian"
Error message:
Error: Syntax error. Found 'Asian'
I tried a few other formulas but also received Error: Field Ethnicity_Sub_Category__c is a picklist field. Picklist fields are only supported in certain functions.
Is there a way to do this?
Thanks in advance
Please find the tested code. Make changes to the picklist field as per your requirement.
Test results:
Image 1
Image 2
Hope it will resolve the issue. Share the results here.
Naveen
Team Codengine.in
All Answers
Please find the tested code. Make changes to the picklist field as per your requirement.
Test results:
Image 1
Image 2
Hope it will resolve the issue. Share the results here.
Naveen
Team Codengine.in
Thank you so much, it worked! Really appreciate your help
Final formula:
IF(ISPICKVAL(Ethnicity_Sub_Category__c , "Bangladeshi"), 'Asian',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Chinese"), 'Asian',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Indian"), 'Asian',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Pakistani"), 'Asian',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Vietnamese"), 'Asian',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Asian Other"), 'Asian',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Angolan"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Caribbean"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Congolese"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Ghanaian"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Nigerian"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Sierra Leonean"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Somali"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Sudanese"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Black African Other"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Black Asian"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Black British"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Black Other"), 'Black',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "White and Black African"), 'Mixed',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "White and Black Caribbean"), 'Mixed',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "White and Asian"), 'Mixed',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Mixed Other"), 'Mixed',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "White British"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "White Irish"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Traveller of Irish Heritage"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Icelanders"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Liechtensteiner"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Swiss"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Norwegian"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Albanian"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Bulgarian"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Romanian"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Orthodox Jewish"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Polish"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Other White Background"), 'White',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Afghan"), 'Other Ethnic Group',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Kurdish"), 'Other Ethnic Group',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Turkish Cypriot"), 'Other Ethnic Group',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Greek Cypriot"), 'Other Ethnic Group',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Latin/South/Central America"), 'Other Ethnic Group',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Arab"), 'Other Ethnic Group',
IF(ISPICKVAL(Ethnicity_Sub_Category__c, "Other Ethnic"), 'Other Ethnic Group','')
)))))))))))))))))))))))))))))))))))))))))
Example of test:
Best,
Cara
Happy coding,
Naveen | Team codengine.in