cross reference two cells in one sheet against two cells in second sheet - return data from third cell

osaben

Board Regular
Joined
Mar 17, 2010
Messages
62
Office Version
  1. 365
Platform
  1. Windows
Hello,
Help please. I have myself all confused on how to accomplish the following.

Column H2/Sheet1 --- match data in last 4 characters in C2 & all of D2 against data in column B & C in Sheet2 and return the value in column D
Column I2/Sheet1 --- match data in I1 & D2 against data in column B & C in Sheet2 and return the value in Column D
Column J2/Sheet 1 --- match data in J1 & D2 against data in column B & C in Sheet2 and return value in column D

SO----when the formula is working right, the figures in Sheet1 with match those in Sheet2 (I color coded to help with explanation)

Thanks in advance for your help and expertise.

1730307233558.png
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Blue - =INDEX(Sheet2!D:D, MATCH(1, ($D2=Sheet2!B:B)*(RIGHT($C2, 4)=Sheet2!C:C), 0))
Pink - =INDEX(Sheet2!D:D, MATCH(1, ($D4=Sheet2!B:B)*(RIGHT($C4, 4)=Sheet2!C:C), 0))
Green - =INDEX(Sheet2!D:D, MATCH(1, ($D6=Sheet2!B:B)*(RIGHT($C6, 4)=Sheet2!C:C), 0))
Peach - =INDEX(Sheet2!D:D, MATCH(1, ($D2=Sheet2!B:B)*($I$1=Sheet2!C:C), 0))
Yellow - =INDEX(Sheet2!D:D, MATCH(1, ($D2=Sheet2!B:B)*($J$1=Sheet2!C:C), 0))
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Blue - =INDEX(Sheet2!D:D, MATCH(1, ($D2=Sheet2!B:B)*(RIGHT($C2, 4)=Sheet2!C:C), 0))
Pink - =INDEX(Sheet2!D:D, MATCH(1, ($D4=Sheet2!B:B)*(RIGHT($C4, 4)=Sheet2!C:C), 0))
Green - =INDEX(Sheet2!D:D, MATCH(1, ($D6=Sheet2!B:B)*(RIGHT($C6, 4)=Sheet2!C:C), 0))
Peach - =INDEX(Sheet2!D:D, MATCH(1, ($D2=Sheet2!B:B)*($I$1=Sheet2!C:C), 0))
Yellow - =INDEX(Sheet2!D:D, MATCH(1, ($D2=Sheet2!B:B)*($J$1=Sheet2!C:C), 0))
appreciate your willingness to help. I am afraid that maybe my color coding created confusion.

I assume there would only need to be three different formulas:
1) Sheet1/Column H
2) Sheet1/Column I
3) Sheet1/Column J

When I copy the formulas down in each column, the data returned will vary based on the varying Fiscal years and Orgs.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Done. Thank you for the reminder.
 
Upvote 0
Thanks for that. (y)
How about In H2 copied down
Excel Formula:
=FILTER(Sheet2!$D$2:$D$1000,(Sheet2!$B$2:$B$1000=D2)*(Sheet2!$C$2:$C$1000=RIGHT(C2,4)),"No match")
and in I2 copied down & across
Excel Formula:
=FILTER(Sheet2!$D$2:$D$1000,(Sheet2!$B$2:$B$1000=$D2)*(Sheet2!$C$2:$C$1000=I$1),"No match")
 
Upvote 0
Solution
Thanks for that. (y)
How about In H2 copied down
Excel Formula:
=FILTER(Sheet2!$D$2:$D$1000,(Sheet2!$B$2:$B$1000=D2)*(Sheet2!$C$2:$C$1000=RIGHT(C2,4)),"No match")
and in I2 copied down & across
Excel Formula:
=FILTER(Sheet2!$D$2:$D$1000,(Sheet2!$B$2:$B$1000=$D2)*(Sheet2!$C$2:$C$1000=I$1),"No match")
Getting closer.......the correct data is pulling into columns H-J for rows3, 5 & 7. But there is a No match for columns H-J for rows 2, 4 & 6).

In this example, There should be not instances where there is no match.

Thanks again.
 
Upvote 0
Check that you don't have any trailing spaces in col C of sheet1 & that you have actual numbers in col D
 
Upvote 0
That was it!....there are trailing spaces in some of the cells in Column E.

I tried to use the find& replace option as well as the TRIM function and neither are working to remove the trailing spaces. any other suggestions?

please & thank you.
 
Upvote 0
The formula is not looking at col E, wo which column has the trailing spaces?
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,128
Members
453,021
Latest member
Justyna P

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