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
Lukasz PiziakLukasz Piziak 

Formula field IF AND based on many variables?

I'm looking for a help with the formula field based on the following criteria: This is to obtain the correct lable size (A, B, C) depend on product size (16, 32, 48) and number of lines (Line 1, Line 2 ...) used to create a specific label.

IF 'size' is equal 16
AND 'Line 1' does not contain 'N/A'
AND 'Line 2' does not contain 'N/A'
return should be value 'A'
IF 'size' is equal 32
AND 'Line 1' does not contain 'N/A'
AND 'Line 2' does not contain 'N/A'
AND 'Line 3' does not contain 'N/A'
return should be value 'B'
IF 'Size' is equal 32
AND 'Line 1' does not contain 'N/A'
AND 'Line 2' does not conatin 'N/A'
AND 'Line 3' does not contain 'N/A'
AND 'Line 4' does not conatin 'N/A'
return should be value 'C'

Fields Line 1,2,3,4 are picklist field type.
Thank you for any help.
Nitin PaliwalNitin Paliwal
Hi,
Try this,

IF(size = 16,
    (IF(AND(NOT(ISPICKVAL(Line 1,'N/A')),NOT(ISPICKVAL(Line 2,'N/A')),OR(ISPICKVAL(Line 3,'N/A'),ISPICKVAL(Line 4,'N/A'))),'A','')),
    (IF(size = 32,
            IF(AND(NOT(ISPICKVAL(Line 1,'N/A')),NOT(ISPICKVAL(Line 2,'N/A')),NOT(ISPICKVAL(Line 3,'N/A')),(ISPICKVAL(Line 4,'N/A'))),'B',
                IF(AND(NOT(ISPICKVAL(Line 1,'N/A')),NOT(ISPICKVAL(Line 2,'N/A')),NOT(ISPICKVAL(Line 3,'N/A')),NOT(ISPICKVAL(Line 4,'N/A'))),'C','')
              )
        ))
    )

Thanks
Nitin