Getting different result According to contents of columns

dpra

New Member
Joined
Jul 3, 2012
Messages
2

<colgroup><col width="64" span="4" style="width:48pt"><col width="64" style="width:48pt"></colgroup><tbody></tbody>
I am trying to get result in a column based on contents of previous 4 columns.
For example as per table below, if there is value 1 in either of first 4 columns of same row, I want to display A in column 5. As first 4 columns in row 2 to 4 contains 1, result is A.
If there is any 2 in first 4 columns, I want to display B.
If there are both 1 and 2 in any first 4 columns, I want to display C.
If there is 3 in any of first 4 columns, I want to display D.
And if all 1, 2 and 3 are in any of first 4 columns, I want to display E.

I would really appreciate if someone can help me putting some sort of conditional formula with what I want to achieve.


NY1
NY2
NY3
NY4
Result
1
5937
A
8
1
7
11
A
9
1
8
9
A
2
18
0
10
B
2
19
17
15
B
1
2
17
12
C
5
2
1
7
C
3
10
18
8
D
1
2
3
18
E
4
3
1
2
E

<tbody>
</tbody>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
If each number can appear only once:

=IF(SUM(COUNTIF(A2:D2,{1,2,3}))=3,"E",IF(SUM(COUNTIF(A2:D2,{1,2}))=2,"C",IF(COUNTIF(A2:D2,1),"A",IF(COUNTIF(A2:D2,2),"B",IF(COUNTIF(A2:D2,3),"D","")))))
 
Upvote 0
If each number can appear only once:

=IF(SUM(COUNTIF(A2:D2,{1,2,3}))=3,"E",IF(SUM(COUNTIF(A2:D2,{1,2}))=2,"C",IF(COUNTIF(A2:D2,1),"A",IF(COUNTIF(A2:D2,2),"B",IF(COUNTIF(A2:D2,3),"D","")))))

Thank You very much Andrew. This solved my problem.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,218
Members
449,091
Latest member
jeremy_bp001

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top