Excel formula where if Sheet1 Column A equal Sheet2 Column A AND Sheet1 Column B equals Sheet2 Column B, then copy certain data from Sheet2 to Sheet 1

Viewed 50

What I want is if Location and Case Number line up on Sheet1 and Sheet2, add in the Attorney information from Sheet2 to Sheet1. Here's a sample of the kind of data I'm dealing with:

Sample Data

We have repeated case numbers in multiple locations, so the data needs to match case number and location before inputting attorney names.

I stupidly deleted my previous attempts before thinking to ask for help, but I got pretty much every error in the book (#spill, #N/A, #ERROR, etc) I kept getting errors for VLOOKUP, and then I tried IFS, and still can't get anything to work.

My most recent attempt is: Attempt

=IFS((A:A=Attorneys!A:A)AND(Sheet1!B:B=Attorneys!B:B), Attorneys!F:F)

Which resulted in #SPILL!

Then: Adjusted Attempt

=@IFS((@A:A=@Attorneys!A:A)*AND(@Sheet1!B:B=@Attorneys!B:B),Attorneys!F:F)

Which resulted in most #N/A, but some random rows populated with one attorney's name, but none of the others.

I've done something similar before, but I was only trying to verify one column of data, not two, and that seems to be breaking my brain. I know I'm missing something really simple in here, but I just can't see it.

Edit: I also tried Index because I forgot about that one, but I'm 99% sure I did it very incorrectly.

=INDEX(Attorneys!F:F,MATCH(A1&B1,Attorneys!A:A&Attorneys!B:B, 0))

And I got #N/A with no helpful information on the calculation error. This is the error I got: Index Error

Edit 2: I had a stray comma which was causing the error on the Index! I still have some random entries where it's #N/A instead of a name, and I need to check to verify that the data is populating correctly instead of just putting in a random name.

Final edit: Index without typos did it!

=INDEX(Sheet2!F:F,MATCH(A2&B2,Sheet2!A:A&Sheet2!B:B,0))
2 Answers

Try index/match like:

=INDEX($C$2:$C$4,MATCH(A7,IF($B$2:$B$4=B7,$A$2:$A$4),0))

enter image description here

Thanks to u/findwindow, this is solved!

=INDEX(Sheet2!F:F,MATCH(A2&B2,Sheet2!A:A&Sheet2!B:B,0))

In my case, Sheet2 is called Attorneys, and I have headers so I skipped all of row 1.

Related