Vlookup and match issue

petrutms

New Member
Joined
Mar 1, 2021
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hi, i am trying to find a value in one sheet and match in on another. I used vlookup but I cant find the right syntax. Index works but if I drag the formula doesn't. Attached a sample to understand what I need: I need to find "a" and "b " values from values sheet and paste them in county sheet, with drag formula!
Any help is appreciated !

Book1
ABCDEFGHI
1janfebmaraprmayjunjulaug
2a
3b
county



Book1
ABCDEFGHI
1janfebmaraprmayjunjulaug
211111111
3s44444444
4c22222222
5d44444444
6e55555555
7f33333333
8g11111111
9h44444444
10i22222222
11a44444444
12k55555555
13l33333333
14m11111111
15b44444444
16o22222222
17p44444444
18q55555555
values
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
In B2 copied to full range
Excel Formula:
=IFERROR(INDEX(values!$B$2:$I$18,MATCH(country!A2,values!$A$2:$A$18,0),MATCH(country!B$1,values!$B$1:$I$1,0)),"")
 
Upvote 0
Solution
=SUMPRODUCT((values!$A$2:$A$18=$A2)*(values!$B$1:$I$1=B$1)*(values!$B$2:$I$18))

As its numbers and also - if A or B appers more than oncve

I changes the values for A and B - so it was not just 4

Book2
ABCDEFGHI
1janfebmaraprmayjunjulaug
2a12345678
3b87654321
Sheet1
Cell Formulas
RangeFormula
B2:I3B2=SUMPRODUCT((values!$A$2:$A$18=$A2)*(values!$B$1:$I$1=B$1)*(values!$B$2:$I$18))



Book2
ABCDEFGHI
1janfebmaraprmayjunjulaug
211111111
3s44444444
4c22222222
5d44444444
6e55555555
7f33333333
8g11111111
9h44444444
10i22222222
11a12345678
12k55555555
13l33333333
14m11111111
15b87654321
16o22222222
17p44444444
18q55555555
values
 
Upvote 0
the a, b are unique, i will try noe both solutions and report back. Thanks
 
Upvote 0
the a, b are unique
Then just use

kvsrinivasamurthy

Solution

Although you may need a $ on the A2 lookup as you copy across
=IFERROR(INDEX(values!$B$2:$I$18,MATCH(country!$A2,values!$A$2:$A$18,0),MATCH(country!B$1,values!$B$1:$I$1,0)),"")
 
Upvote 0
Then just use

kvsrinivasamurthy

Solution

Although you may need a $ on the A2 lookup as you copy across
=IFERROR(INDEX(values!$B$2:$I$18,MATCH(country!$A2,values!$A$2:$A$18,0),MATCH(country!B$1,values!$B$1:$I$1,0)),"")

yes that works fine and that is the only change I did. Thanks for the help all!
 
Upvote 0
country
B2=IF(AND(country!A2<>"",country!B$1<>""),SUMIF(values!$A$2:$A$18,country!$A2,INDEX(values!$B$2:$I$18,,MATCH(country!B$1,values!$B$1:$I$1,0))),"")

Copy across and down
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,570
Members
452,652
Latest member
eduedu

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