3

My data looks like:

id   state   value
1     abc      x
1     bcd      y
1     def      z
2     abc      p
2     bcd      q
2     def      r
3     bcd      m
3     def      n

I am trying to vlookup the value for id 1, 2 and so on, but where the state is not abc. Excel automatically picks the first entry and I tried with if condition on the column but am unable to get it work. I even tried Index Match with an if condition inside match, but that didn't work either.

Is there a way I could do it?

player0
  • 124,011
  • 12
  • 67
  • 124
Bruce Wayne
  • 471
  • 5
  • 18

2 Answers2

3

Use Filter:

=index(filter(C2:C9,A2:A9=1,B2:B9<>"abc"),1)

enter image description here

if you want all that meet the criteria, remove the INDEX wrapper:

filter(C2:C9,A2:A9=1,B2:B9<>"abc")

enter image description here

Scott Craner
  • 148,073
  • 10
  • 49
  • 81
1

try:

=FILTER(C:C, B:B<>"abc", REGEXMATCH(A:A&"", "1|2"))

0


or just:

=FILTER(C:C, B:B<>"abc")

for partial abc you can do:

=FILTER(C:C, NOT(REGEXMATCH(B:B, "abc")))
player0
  • 124,011
  • 12
  • 67
  • 124