Look at 2 values to return one result

peterman25

New Member
Joined
Jul 6, 2016
Messages
11
I've been racking my brain on this one, but can't seem to get it...

I am looking at 2 pieces of data, but want to return one result. The result comes from a different worksheet (table). I'm wanting to do so without moving data around. I know that I could concatenate the 2 pieces of data in the 2 worksheets and then just do a vlookup, but is it possible without having to do those steps and just leaving the worksheets as they are dumped out of the systems that create them?

Worksheet 1 - Column B is an employee ID that is unique. Column E is a department code. What I am trying to do is look at both values to return a job reference code to column F.


1601339802323.png



Worksheet 2 - Has the employee ID (column A) and the department code (column E) AND the job reference code (column G) that I am trying to return.

1601340208716.png



Thank you for any assistance / guidance.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
A small sample of data AND the answer you would expect from that data would help !
I'm guessing a SUMPRODUCT function might do the trick here.
Using the XL2BB download would make it easier to work with as well.....See my tage for the download link
 
Upvote 0
Assuming your worksheet tab names are Sheet1 and Sheet2, and your data extends down to row 100 in Sheet2, in F2 of Sheet1 and copy down:

=INDEX(Sheet2!$A$2:$G$100,MATCH(Sheet1!B2&"|"&Sheet1!E2,Sheet2!$A$2:$A$100&"|"&Sheet2!$E$2:$E$100,0),7)
 
Upvote 0
A small sample of data AND the answer you would expect from that data would help !
I'm guessing a SUMPRODUCT function might do the trick here.
Using the XL2BB download would make it easier to work with as well.....See my tage for the download link

Here is an example of what I am trying to return...

I'm trying to return the value from Column G in Sheet 2 to Column F in Sheet1 based upon matching the data in Columns B and E in Sheet1 to the data in Columns A and E in Sheet2

@JoeMo - I tried your formula and received the error shown. I appreciate your efforts. Thank you.

Sheet1

1601397235254.png


Sheet2

1601397312650.png
 
Upvote 0
@JoeMo - I tried your formula and received the error shown. I appreciate your efforts. Thank you.
I'm using Excel for Office 365. If you are not, try confirming the formula with ctrl+shift+Enter to make it an array formula and then copy it down.
 
Upvote 0
I'm using Excel for Office 365. If you are not, try confirming the formula with ctrl+shift+Enter to make it an array formula and then copy it down.

Does the data have to be in exact matching order on both sheets in rows? Because it won't be. Does row 1 on each sheet need to be employee 12345?
 
Upvote 0
Does the data have to be in exact matching order on both sheets in rows? Because it won't be. Does row 1 on each sheet need to be employee 12345?
No. Is the formula still returning an error? If not, you must not include the formula column (col F sheet1) in any sorting of the data you do.
Here's a simplified example:
Sheet1
Book1
ABCDEF
1NameIDhdr3hdr4DeptRef Code
2DGHIdatadata666AB1000
3CDEFdatadata789AB7909
4BABCdatadata456AB3155
5AXYZdatadata123AB6286
Sheet1
Cell Formulas
RangeFormula
F2:F5F2=INDEX(Sheet2!$A$2:$G$5,MATCH(Sheet1!B2&"|"&Sheet1!E2,Sheet2!$A$2:$A$5&"|"&Sheet2!$E$2:$E$5,0),7)

Sheet2
Book1
ABCDEFG
1IDhdr2hdr3hdr4Depthdr6Ref Code
2XYZdatadatadata123dataAB6286
3ABCdatadatadata456dataAB3155
4DEFdatadatadata789dataAB7909
5GHIdatadatadata666dataAB1000
Sheet2
 
Last edited:
Upvote 0
No. Is the formula still returning an error? If not, you must not include the formula column (col F sheet1) in any sorting of the data you do.
Here's a simplified example:
Sheet1
Book1
ABCDEF
1NameIDhdr3hdr4DeptRef Code
2DGHIdatadata666AB1000
3CDEFdatadata789AB7909
4BABCdatadata456AB3155
5AXYZdatadata123AB6286
Sheet1
Cell Formulas
RangeFormula
F2:F5F2=INDEX(Sheet2!$A$2:$G$5,MATCH(Sheet1!B2&"|"&Sheet1!E2,Sheet2!$A$2:$A$5&"|"&Sheet2!$E$2:$E$5,0),7)

Sheet2
Book1
ABCDEFG
1IDhdr2hdr3hdr4Depthdr6Ref Code
2XYZdatadatadata123dataAB6286
3ABCdatadatadata456dataAB3155
4DEFdatadatadata789dataAB7909
5GHIdatadatadata666dataAB1000
Sheet2

I tried it myself with generic data in a brand new workbook...still errors out.

Sheet1

1601403966930.png


Sheet2

1601404013332.png
 
Upvote 0
I can get the formula to work with a single value to return data. It's when the formula is trying to combine the 2 values that it doesn't want to work.

Single value - =INDEX(Sheet2!$A$2:$G$5,MATCH(B2,Sheet2!$A$2:$A$5,0),7)

1601407107132.png


Combining the 2 values (formula is different in row 6)

1601407224795.png
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,386
Members
449,155
Latest member
ravioli44

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