ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   selecting an answer based on a 3 way logic (https://www.excelbanter.com/excel-worksheet-functions/167865-selecting-answer-based-3-way-logic.html)

Sam B

selecting an answer based on a 3 way logic
 
Here is a sample of the data.

Condition 1 Condition 2 Condition 3 Type
Problem A Type A
Problem B Type B
Problem C yes no
Type B
Problem C yes yes
Type B
Problem C no yes
Type C

Based on Conditions 1, 2 and 3 I want to fill out Type A, B or C in the
forth column. So the logic would be

If condition 1 = Problem A then Type A
If condition 1 = Problem B then Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = no then
Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = yes then
Type B
If condition 1 = Problem C and Condition 2=no and condition 3 = yes then
Type C

Teethless mama

selecting an answer based on a 3 way logic
 
=IF(A2="Problem A","Type A",IF(A2="Problem B","Type B",IF(AND(A2="Problem
C",B2="Yes",OR(C2={"Yes","No"})),"Type B",IF(AND(A2="Problem
C",B2="No",C2="Yes"),"Type C","undefined"))))


"Sam B" wrote:

Here is a sample of the data.

Condition 1 Condition 2 Condition 3 Type
Problem A Type A
Problem B Type B
Problem C yes no
Type B
Problem C yes yes
Type B
Problem C no yes
Type C

Based on Conditions 1, 2 and 3 I want to fill out Type A, B or C in the
forth column. So the logic would be

If condition 1 = Problem A then Type A
If condition 1 = Problem B then Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = no then
Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = yes then
Type B
If condition 1 = Problem C and Condition 2=no and condition 3 = yes then
Type C


Sam B[_2_]

selecting an answer based on a 3 way logic
 
Thank you for the quick reply. I tried this and I get "undefined" for the
last three rows, instead of Type B, Type B, Type C

"Teethless mama" wrote:

=IF(A2="Problem A","Type A",IF(A2="Problem B","Type B",IF(AND(A2="Problem
C",B2="Yes",OR(C2={"Yes","No"})),"Type B",IF(AND(A2="Problem
C",B2="No",C2="Yes"),"Type C","undefined"))))


"Sam B" wrote:

Here is a sample of the data.

Condition 1 Condition 2 Condition 3 Type
Problem A Type A
Problem B Type B
Problem C yes no
Type B
Problem C yes yes
Type B
Problem C no yes
Type C

Based on Conditions 1, 2 and 3 I want to fill out Type A, B or C in the
forth column. So the logic would be

If condition 1 = Problem A then Type A
If condition 1 = Problem B then Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = no then
Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = yes then
Type B
If condition 1 = Problem C and Condition 2=no and condition 3 = yes then
Type C


Sam B[_2_]

selecting an answer based on a 3 way logic
 
Found the problem. It was a typo. Thank you.

"Teethless mama" wrote:

=IF(A2="Problem A","Type A",IF(A2="Problem B","Type B",IF(AND(A2="Problem
C",B2="Yes",OR(C2={"Yes","No"})),"Type B",IF(AND(A2="Problem
C",B2="No",C2="Yes"),"Type C","undefined"))))


"Sam B" wrote:

Here is a sample of the data.

Condition 1 Condition 2 Condition 3 Type
Problem A Type A
Problem B Type B
Problem C yes no
Type B
Problem C yes yes
Type B
Problem C no yes
Type C

Based on Conditions 1, 2 and 3 I want to fill out Type A, B or C in the
forth column. So the logic would be

If condition 1 = Problem A then Type A
If condition 1 = Problem B then Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = no then
Type B
If condition 1 = Problem C and Condition 2=yes and condition 3 = yes then
Type B
If condition 1 = Problem C and Condition 2=no and condition 3 = yes then
Type C



All times are GMT +1. The time now is 03:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com