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
Slobodan AtanasovSlobodan Atanasov 

Compare two values from a picklist

I have 3 companies, and want to compare how many accounts are customers between these companies. 

the picklist is Customer, Prospect, Competitor

I want to do this with a row level formula for example

If company 1 = TRUE, and company 2 = TRUE it is Company 1 and 2 
if comapny 1 = TRUE and company 3 = TRUE it is Comapny 1 and 3
if comapny 2 = TRUE and company 3 = TRUE it is Company 2 and 3
Best Answer chosen by Slobodan Atanasov
SubratSubrat (Salesforce Developers) 
Hello Slobodan,

To compare the number of customer accounts between three companies and generate a row-level formula, you can use a combination of logical conditions and formula fields. Here's an example of how you can achieve this:

Please use this below formula for the same :
IF(
    ISPICKVAL(Company1_c, "Customer") && ISPICKVAL(Company2c, "Customer") && ISPICKVAL(Company3_c, "Customer"),
    "Company 1, 2, and 3",
    IF(
        ISPICKVAL(Company1_c, "Customer") && ISPICKVAL(Company2_c, "Customer"),
        "Company 1 and 2",
        IF(
            ISPICKVAL(Company1_c, "Customer") && ISPICKVAL(Company3_c, "Customer"),
            "Company 1 and 3",
            IF(
                ISPICKVAL(Company2_c, "Customer") && ISPICKVAL(Company3_c, "Customer"),
                "Company 2 and 3",
                ""
            )
        )
    )
)
Replace Company1_c, Company2c, and Company3_c with the actual API names of the picklist fields representing the three companies.



If this helps , please mark this as Best Answer.
Thank you.