We’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.
Choose Language Hide Translation Bar
Highlighted

## Nest If() Statements

Good Afternoon,

I am trying to calculate "pass/fail" based on a give set of spec limits. The problem i am running into is that i have approximately 386 devices on a wafer that is tested on 16 different channels which all have different spec limits. To top that off, I have 2 different test conditions. The only solution i have is a ton of IF() statements

If( (:Channel == 0 ) & (:test_output >= 16) & (test_output <= 22), 1, 99)

new column( "pass/fail") << formula( If( condition, result 1, etc.)

If there is an easier way i am all ears.

Thanks

I have attached 1 of the tables that i need to perform this action on..

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Nest If() Statements

Thanks for the input i just ended up doing the following

``````	new column( "I/O" ) << Formula(
If(
(:trmode == "Rx") & (:Channel == 0) & (:TEST_OUTPUT >= 6.16) & (:TEST_OUTPUT <= 23.59), 1,
(:trmode == "Rx") & (:Channel == 1) & (:TEST_OUTPUT >= 22.47) & (:TEST_OUTPUT <= 36.72), 1,
(:trmode == "Rx") & (:Channel == 2) & (:TEST_OUTPUT >= 20.65) & (:TEST_OUTPUT <= 33.77), 1,
(:trmode == "Rx") & (:Channel == 3) & (:TEST_OUTPUT >= 21.79) & (:TEST_OUTPUT <= 41.64), 1,
(:trmode == "Rx") & (:Channel == 4) & (:TEST_OUTPUT >= 18.73) & (:TEST_OUTPUT <= 32.72), 1,
(:trmode == "Rx") & (:Channel == 5) & (:TEST_OUTPUT >= 18.53) & (:TEST_OUTPUT <= 32.42), 1,
(:trmode == "Rx") & (:Channel == 6) & (:TEST_OUTPUT >= 23.42) & (:TEST_OUTPUT <= 40.84), 1,
(:trmode == "Rx") & (:Channel == 7) & (:TEST_OUTPUT >= 21.96) & (:TEST_OUTPUT <= 47.10), 1,
(:trmode == "Rx") & (:Channel == 8) & (:TEST_OUTPUT >= 18.98) & (:TEST_OUTPUT <= 48.50), 1,
(:trmode == "Rx") & (:Channel == 9) & (:TEST_OUTPUT >= 20.07) & (:TEST_OUTPUT <= 41.04), 1,
(:trmode == "Rx") & (:Channel == 10) & (:TEST_OUTPUT >= 25.25) & (:TEST_OUTPUT <= 49.21), 1,
(:trmode == "Rx") & (:Channel == 11) & (:TEST_OUTPUT >= 21.91) & (:TEST_OUTPUT <= 35.20), 1,
(:trmode == "Rx") & (:Channel == 12) & (:TEST_OUTPUT >= 22.49) & (:TEST_OUTPUT <= 40.70), 1,
(:trmode == "Rx") & (:Channel == 13) & (:TEST_OUTPUT >= 25.39) & (:TEST_OUTPUT <= 41.81), 1,
(:trmode == "Rx") & (:Channel == 14) & (:TEST_OUTPUT >= 22.50) & (:TEST_OUTPUT <= 41.92), 1,
(:trmode == "Rx") & (:Channel == 15) & (:TEST_OUTPUT >= 23.65) & (:TEST_OUTPUT <= 46.53), 1, 0
)
);``````
4 REPLIES 4
Highlighted

## Re: Nest If() Statements

Create a new data table with columns for chanel, test condition, upper limit and lower limit.  Then simply join the tables together, matching on chanel and test condition.  Then using the upper and lower limit columns, calculate the pass/fail

Jim
Highlighted

## Re: Nest If() Statements

That was my original thought however I wanted to give the Test Engineers/Management the freedom to adjust the limits if they choose to do so.

I didn't include all the information and for that i am sorry. Attached is a subscript from my overall data pull script that pops out when you hit the "yield" button box in my main window. I wanted to use the variables set in this script in my nested if() statements.

Thanks for your input so far.

Highlighted

## Re: Nest If() Statements

Thanks for the input i just ended up doing the following

``````	new column( "I/O" ) << Formula(
If(
(:trmode == "Rx") & (:Channel == 0) & (:TEST_OUTPUT >= 6.16) & (:TEST_OUTPUT <= 23.59), 1,
(:trmode == "Rx") & (:Channel == 1) & (:TEST_OUTPUT >= 22.47) & (:TEST_OUTPUT <= 36.72), 1,
(:trmode == "Rx") & (:Channel == 2) & (:TEST_OUTPUT >= 20.65) & (:TEST_OUTPUT <= 33.77), 1,
(:trmode == "Rx") & (:Channel == 3) & (:TEST_OUTPUT >= 21.79) & (:TEST_OUTPUT <= 41.64), 1,
(:trmode == "Rx") & (:Channel == 4) & (:TEST_OUTPUT >= 18.73) & (:TEST_OUTPUT <= 32.72), 1,
(:trmode == "Rx") & (:Channel == 5) & (:TEST_OUTPUT >= 18.53) & (:TEST_OUTPUT <= 32.42), 1,
(:trmode == "Rx") & (:Channel == 6) & (:TEST_OUTPUT >= 23.42) & (:TEST_OUTPUT <= 40.84), 1,
(:trmode == "Rx") & (:Channel == 7) & (:TEST_OUTPUT >= 21.96) & (:TEST_OUTPUT <= 47.10), 1,
(:trmode == "Rx") & (:Channel == 8) & (:TEST_OUTPUT >= 18.98) & (:TEST_OUTPUT <= 48.50), 1,
(:trmode == "Rx") & (:Channel == 9) & (:TEST_OUTPUT >= 20.07) & (:TEST_OUTPUT <= 41.04), 1,
(:trmode == "Rx") & (:Channel == 10) & (:TEST_OUTPUT >= 25.25) & (:TEST_OUTPUT <= 49.21), 1,
(:trmode == "Rx") & (:Channel == 11) & (:TEST_OUTPUT >= 21.91) & (:TEST_OUTPUT <= 35.20), 1,
(:trmode == "Rx") & (:Channel == 12) & (:TEST_OUTPUT >= 22.49) & (:TEST_OUTPUT <= 40.70), 1,
(:trmode == "Rx") & (:Channel == 13) & (:TEST_OUTPUT >= 25.39) & (:TEST_OUTPUT <= 41.81), 1,
(:trmode == "Rx") & (:Channel == 14) & (:TEST_OUTPUT >= 22.50) & (:TEST_OUTPUT <= 41.92), 1,
(:trmode == "Rx") & (:Channel == 15) & (:TEST_OUTPUT >= 23.65) & (:TEST_OUTPUT <= 46.53), 1, 0
)
);``````
Highlighted

## Re: Nest If() Statements

The way I've done this in Excel, though not the quickest, does help avoid making mistakes.  Create a 0/1 column for each channel using IF and AND to see if it is within the specification limits.  Then just multiply the columns together - you will only get 1 if all channels are within limits.