Multiple IF statements in one cell

Zenroxy

New Member
Joined
Aug 24, 2021
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hoping to get some help with this:

I have 36 possibilities for one cell. Just wondering if it is possible to include them all? Thanks for your help.

=IF((AND(D2="L6 - Almost Unprecedented",E2="C6 - Insignificant")),"D","")
=IF((AND(D2="L6 - Almost Unprecedented",E2="C5 - Minor")),"D","")
=IF((AND(D2="L6 - Almost Unprecedented",E2="C4 - Moderate")),"D","")
=IF((AND(D2="L6 - Almost Unprecedented",E2="C3 - Major")),"D","")
=IF((AND(D2="L6 - Almost Unprecedented",E2="C2 - Severe")),"C","")
=IF((AND(D2="L6 - Almost Unprecedented",E2="C1 - Catastrophic")),"C","")
=IF((AND(D2="L5 - Very Unlikely",E2="C6 - Insignificant")),"D","")
=IF((AND(D2="L5 - Very Unlikely",E2="C5 - Minor")),"D","")
=IF((AND(D2="L5 - Very Unlikely",E2="C4 - Moderate")),"D","")
=IF((AND(D2="L5 - Very Unlikely",E2="C3 - Major")),"C","")
=IF((AND(D2="L5 - Very Unlikely",E2="C2 - Severe")),"C","")
=IF((AND(D2="L5 - Very Unlikely",E2="C1 - Catastrophic")),"B","")
=IF((AND(D2="L4 - Unlikely",E2="C6 - Insignificant")),"D","")
=IF((AND(D2="L4 - Unlikely",E2="C5 - Minor")),"D","")
=IF((AND(D2="L4 - Unlikely",E2="C4 - Moderate")),"C","")
=IF((AND(D2="L4 - Unlikely",E2="C3 - Major")),"C","")
=IF((AND(D2="L4 - Unlikely",E2="C2 - Severe")),"B","")
=IF((AND(D2="L4 - Unlikely",E2="C1 - Catastrophic")),"B","")
=IF((AND(D2="L3 - Likely",E2="C6 - Insignificant")),"D","")
=IF((AND(D2="L3 - Likely",E2="C5 - Minor")),"C","")
=IF((AND(D2="L3 - Likely",E2="C4 - Moderate")),"C","")
=IF((AND(D2="L3 - Likely",E2="C3 - Major")),"B","")
=IF((AND(D2="L3 - Likely",E2="C2 - Severe")),"B","")
=IF((AND(D2="L3 - Likely",E2="C1 - Catastrophic")),"A","")
=IF((AND(D2="L2 - Very Likely",E2="C6 - Insignificant")),"C","")
=IF((AND(D2="L2 - Very Likely",E2="C5 - Minor")),"C","")
=IF((AND(D2="L2 - Very Likely",E2="C4 - Moderate")),"B","")
=IF((AND(D2="L2 - Very Likely",E2="C3 - Major")),"B","")
=IF((AND(D2="L2 - Very Likely",E2="C2 - Severe")),"A","")
=IF((AND(D2="L2 - Very Likely",E2="C1 - Catastrophic")),"A","")
=IF((AND(D2="L1 - Almost Certain",E2="C6 - Insignificant")),"C","")
=IF((AND(D2="L1 - Almost Certain",E2="C5 - Minor")),"B","")
=IF((AND(D2="L1 - Almost Certain",E2="C4 - Moderate")),"B","")
=IF((AND(D2="L1 - Almost Certain",E2="C3 - Major")),"A","")
=IF((AND(D2="L1 - Almost Certain",E2="C2 - Severe")),"A","")
=IF((AND(D2="L1 - Almost Certain",E2="C1 - Catastrophic")),"A","")
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
You wouldn't do that using if statements.
My lookup table is called tblRiskMatrix. As long as you call it that you can put it anywhere in the workbook and the call it that the Table Formulas will work.

20210824 Risk Matrix.xlsx
DEFGHIJKLMNOPQ
1LikelihoodImpactRating Tbl VersionRatingImpact
2L1C4AA
3L2C3BBLikelihoodC1C2C3C4C5C6
4L1AAAABC
5L2AABBCC
6L3
7L4
8L5
9L6
10
Sheet1
Cell Formulas
RangeFormula
F2:F3F2=INDEX(tblRiskMatrix,MATCH($D2,tblRiskMatrix[Likelihood],0),MATCH($E2,tblRiskMatrix[#Headers],0))
G2:G3G2=INDEX($J$3:$P$9,MATCH($D2,$J$3:$J$9,0),MATCH($E2,$J$3:$P$3,0))
 
Upvote 0
Hi Zenroxy,

Alex has a more elegant solution. I'm just a kinda brute force guy.

Zenroxy.xlsx
DEFGHIJKL
1ProbabilityImpactResultD2E2ConcatenatedClass
2L5 - Very UnlikelyC6 - InsignificantDL6 - Almost UnprecedentedC6 - InsignificantL6 - Almost UnprecedentedC6 - InsignificantD
3L5 - Very UnlikelyC1 - CatastrophicBL6 - Almost UnprecedentedC5 - MinorL6 - Almost UnprecedentedC5 - MinorD
4L1 - Almost CertainC6 - InsignificantCL6 - Almost UnprecedentedC4 - ModerateL6 - Almost UnprecedentedC4 - ModerateD
5L6 - Almost UnprecedentedC7 - DisastrousUnknownL6 - Almost UnprecedentedC3 - MajorL6 - Almost UnprecedentedC3 - MajorD
6L5 - Very UnlikelyC4 - ModerateDL6 - Almost UnprecedentedC2 - SevereL6 - Almost UnprecedentedC2 - SevereC
7L5 - Very UnlikelyC3 - MajorCL6 - Almost UnprecedentedC1 - CatastrophicL6 - Almost UnprecedentedC1 - CatastrophicC
8L5 - Very UnlikelyC2 - SevereCL5 - Very UnlikelyC6 - InsignificantL5 - Very UnlikelyC6 - InsignificantD
9L5 - Very UnlikelyC5 - MinorL5 - Very UnlikelyC5 - MinorD
10L5 - Very UnlikelyC4 - ModerateL5 - Very UnlikelyC4 - ModerateD
11L5 - Very UnlikelyC3 - MajorL5 - Very UnlikelyC3 - MajorC
12L5 - Very UnlikelyC2 - SevereL5 - Very UnlikelyC2 - SevereC
13L5 - Very UnlikelyC1 - CatastrophicL5 - Very UnlikelyC1 - CatastrophicB
14L4 - UnlikelyC6 - InsignificantL4 - UnlikelyC6 - InsignificantD
15L4 - UnlikelyC5 - MinorL4 - UnlikelyC5 - MinorD
16L4 - UnlikelyC4 - ModerateL4 - UnlikelyC4 - ModerateC
17L4 - UnlikelyC3 - MajorL4 - UnlikelyC3 - MajorC
18L4 - UnlikelyC2 - SevereL4 - UnlikelyC2 - SevereB
19L4 - UnlikelyC1 - CatastrophicL4 - UnlikelyC1 - CatastrophicB
20L3 - LikelyC6 - InsignificantL3 - LikelyC6 - InsignificantD
21L3 - LikelyC5 - MinorL3 - LikelyC5 - MinorC
22L3 - LikelyC4 - ModerateL3 - LikelyC4 - ModerateC
23L3 - LikelyC3 - MajorL3 - LikelyC3 - MajorB
24L3 - LikelyC2 - SevereL3 - LikelyC2 - SevereB
25L3 - LikelyC1 - CatastrophicL3 - LikelyC1 - CatastrophicA
26L2 - Very LikelyC6 - InsignificantL2 - Very LikelyC6 - InsignificantC
27L2 - Very LikelyC5 - MinorL2 - Very LikelyC5 - MinorC
28L2 - Very LikelyC4 - ModerateL2 - Very LikelyC4 - ModerateB
29L2 - Very LikelyC3 - MajorL2 - Very LikelyC3 - MajorB
30L2 - Very LikelyC2 - SevereL2 - Very LikelyC2 - SevereA
31L2 - Very LikelyC1 - CatastrophicL2 - Very LikelyC1 - CatastrophicA
32L1 - Almost CertainC6 - InsignificantL1 - Almost CertainC6 - InsignificantC
33L1 - Almost CertainC5 - MinorL1 - Almost CertainC5 - MinorB
34L1 - Almost CertainC4 - ModerateL1 - Almost CertainC4 - ModerateB
35L1 - Almost CertainC3 - MajorL1 - Almost CertainC3 - MajorA
36L1 - Almost CertainC2 - SevereL1 - Almost CertainC2 - SevereA
37L1 - Almost CertainC1 - CatastrophicL1 - Almost CertainC1 - CatastrophicA
Sheet1
Cell Formulas
RangeFormula
F2:F8F2=IFERROR(INDEX($L$2:$L$37,MATCH(D2&E2,$K$2:$K$37,0)),"Unknown")
K2:K37K2=I2&J2
 
Upvote 0
You wouldn't do that using if statements.
My lookup table is called tblRiskMatrix. As long as you call it that you can put it anywhere in the workbook and the call it that the Table Formulas will work.

20210824 Risk Matrix.xlsx
DEFGHIJKLMNOPQ
1LikelihoodImpactRating Tbl VersionRatingImpact
2L1C4AA
3L2C3BBLikelihoodC1C2C3C4C5C6
4L1AAAABC
5L2AABBCC
6L3
7L4
8L5
9L6
10
Sheet1
Cell Formulas
RangeFormula
F2:F3F2=INDEX(tblRiskMatrix,MATCH($D2,tblRiskMatrix[Likelihood],0),MATCH($E2,tblRiskMatrix[#Headers],0))
G2:G3G2=INDEX($J$3:$P$9,MATCH($D2,$J$3:$J$9,0),MATCH($E2,$J$3:$P$3,0))
Thanks Alex, much appreciated.
 
Upvote 0
Hi Zenroxy,

Alex has a more elegant solution. I'm just a kinda brute force guy.

Zenroxy.xlsx
DEFGHIJKL
1ProbabilityImpactResultD2E2ConcatenatedClass
2L5 - Very UnlikelyC6 - InsignificantDL6 - Almost UnprecedentedC6 - InsignificantL6 - Almost UnprecedentedC6 - InsignificantD
3L5 - Very UnlikelyC1 - CatastrophicBL6 - Almost UnprecedentedC5 - MinorL6 - Almost UnprecedentedC5 - MinorD
4L1 - Almost CertainC6 - InsignificantCL6 - Almost UnprecedentedC4 - ModerateL6 - Almost UnprecedentedC4 - ModerateD
5L6 - Almost UnprecedentedC7 - DisastrousUnknownL6 - Almost UnprecedentedC3 - MajorL6 - Almost UnprecedentedC3 - MajorD
6L5 - Very UnlikelyC4 - ModerateDL6 - Almost UnprecedentedC2 - SevereL6 - Almost UnprecedentedC2 - SevereC
7L5 - Very UnlikelyC3 - MajorCL6 - Almost UnprecedentedC1 - CatastrophicL6 - Almost UnprecedentedC1 - CatastrophicC
8L5 - Very UnlikelyC2 - SevereCL5 - Very UnlikelyC6 - InsignificantL5 - Very UnlikelyC6 - InsignificantD
9L5 - Very UnlikelyC5 - MinorL5 - Very UnlikelyC5 - MinorD
10L5 - Very UnlikelyC4 - ModerateL5 - Very UnlikelyC4 - ModerateD
11L5 - Very UnlikelyC3 - MajorL5 - Very UnlikelyC3 - MajorC
12L5 - Very UnlikelyC2 - SevereL5 - Very UnlikelyC2 - SevereC
13L5 - Very UnlikelyC1 - CatastrophicL5 - Very UnlikelyC1 - CatastrophicB
14L4 - UnlikelyC6 - InsignificantL4 - UnlikelyC6 - InsignificantD
15L4 - UnlikelyC5 - MinorL4 - UnlikelyC5 - MinorD
16L4 - UnlikelyC4 - ModerateL4 - UnlikelyC4 - ModerateC
17L4 - UnlikelyC3 - MajorL4 - UnlikelyC3 - MajorC
18L4 - UnlikelyC2 - SevereL4 - UnlikelyC2 - SevereB
19L4 - UnlikelyC1 - CatastrophicL4 - UnlikelyC1 - CatastrophicB
20L3 - LikelyC6 - InsignificantL3 - LikelyC6 - InsignificantD
21L3 - LikelyC5 - MinorL3 - LikelyC5 - MinorC
22L3 - LikelyC4 - ModerateL3 - LikelyC4 - ModerateC
23L3 - LikelyC3 - MajorL3 - LikelyC3 - MajorB
24L3 - LikelyC2 - SevereL3 - LikelyC2 - SevereB
25L3 - LikelyC1 - CatastrophicL3 - LikelyC1 - CatastrophicA
26L2 - Very LikelyC6 - InsignificantL2 - Very LikelyC6 - InsignificantC
27L2 - Very LikelyC5 - MinorL2 - Very LikelyC5 - MinorC
28L2 - Very LikelyC4 - ModerateL2 - Very LikelyC4 - ModerateB
29L2 - Very LikelyC3 - MajorL2 - Very LikelyC3 - MajorB
30L2 - Very LikelyC2 - SevereL2 - Very LikelyC2 - SevereA
31L2 - Very LikelyC1 - CatastrophicL2 - Very LikelyC1 - CatastrophicA
32L1 - Almost CertainC6 - InsignificantL1 - Almost CertainC6 - InsignificantC
33L1 - Almost CertainC5 - MinorL1 - Almost CertainC5 - MinorB
34L1 - Almost CertainC4 - ModerateL1 - Almost CertainC4 - ModerateB
35L1 - Almost CertainC3 - MajorL1 - Almost CertainC3 - MajorA
36L1 - Almost CertainC2 - SevereL1 - Almost CertainC2 - SevereA
37L1 - Almost CertainC1 - CatastrophicL1 - Almost CertainC1 - CatastrophicA
Sheet1
Cell Formulas
RangeFormula
F2:F8F2=IFERROR(INDEX($L$2:$L$37,MATCH(D2&E2,$K$2:$K$37,0)),"Unknown")
K2:K37K2=I2&J2
Thanks Toadstool, much appreciated
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

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