0

I have this excel situation:

C2 = "A", D2= "A", set E2 = "A"

C2 = "B", D2 = "B", set E2 = "B"

C2= "B", D2= "A", set E2 = "A"

and....

How can I write such nested formulas for column E to be populated from values of same row column C and D?

We have a 5x5 value table. So if col = "X" and row = "Y" result should be "Z". I need to lookup this table and set value automatically with formula

Please advise

6
  • 1
    How many situations are we talking 3, 4 ,20..? Commented Mar 18, 2016 at 20:41
  • 1
    Generally speaking, in E2, you can do =If(And(C2="A",D2="A"),"A",if(And(C2="B",D2="B"),"B",...). but it looks like you have lots of these. A Vlookup() table might work too. Can you expand on your problem a little more? Commented Mar 18, 2016 at 20:42
  • @ScottCraner, at most 12 situtations Commented Mar 18, 2016 at 20:43
  • @BruceWayne, updated the question. I tried the sample you sent it didn't work Commented Mar 18, 2016 at 20:45
  • 3
    Then as @BruceWayne just stated it would probably be better if you made a table with all the possible combinations and the desire output then use a vlookup or INDEX/MATCH. Nesting an indeterminate amount of IFs is a little daunting. Commented Mar 18, 2016 at 20:46

1 Answer 1

1

If you actually have the values in a 2d table something like this (in a sheet called Lookup say):-

enter image description here

then you can use the table to get the values.

Either using row and column headers:-

=IFERROR(INDEX(Lookup!$B$2:$F$6,MATCH(C2,Lookup!$A$2:$A$6,0),MATCH(D2,Lookup!$B$1:$F$1,0)),"")

or just using the position of the letters in a string:-

=IFERROR(INDEX(Lookup!$B$2:$F$6,FIND(C2,"ABCDE"),FIND(D2,"ABCDE")),"")

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.