Index Match or Vlookup with Multiple Criteria

mariett

New Member
Joined
Mar 8, 2023
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
Hello,

I'm trying to query values from one tab into another using either an index match or vlookup formula with multiple criteria. I've created an example of my file here.

I want to avoid manually copying/pasting my values for each rep, month and metric by using one of these formulas, but so far I haven't had any success with writing the formula. Does anyone know wheat might be missing here?

Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hey Mariett - you're on the right track, but your ranges are different sizes so the results of your MATCH formula are not going to align with the array of your INDEX formula.

INDEX works easiest when you're feeding it both a column value and a row value (=INDEX(array,row,column). If you split your formula up to look at your columns (B & C) for the right row number, and your row (2) for the right column number, then passed them into the INDEX formula, you'd have better results.

The simplest way to perform a multi-value lookup for MATCH'ing is to use a helper column with concatenation. Basically on your first sheet you create a column where you insert a formula that concatenates the results of column B with column C (something like =B3&C3, or =CONCAT(B3,C3). Then you have a single column that you can use to lookup your "row" value for your index formula. Say if you added this formula to column "A", you could use the formula:

Excel Formula:
=INDEX('Example Targets File'!$D:$O,MATCH($A2&$E2,'Example Targets File'!$A:$A,0),MATCH(D2,'Example Targets File'!$2:$2,0)

The last thing to note -it looks like you're in a country that uses a different date format that me, so there were issues with matching the dates in your second table with the dates in your first. Just make sure that they are the same values. You might not want to add 31 days to each in your first table as that's an easy way to throw some of the months off. Instead you could use the EDATE formula to just add 1 month ex. =EDATE(D2,1)

Hope that helps,

Book1.xlsx
ABCDEF
1namemonth_datemonth formattedmonth reversedmetric_namemetric_value
2Rep A1/1/2022Jan-2222-JanMetric 112
3Rep A2/1/2022Feb-2222-FebMetric 19
4Rep A3/1/2022Mar-2222-MarMetric 110
5Rep A4/1/2022Apr-2222-AprMetric 110
6Rep A5/1/2022May-2222-MayMetric 16
7Rep A6/1/2022Jun-2222-JunMetric 111
8Rep A7/1/2022Jul-2222-JulMetric 112
9Rep A8/1/2022Aug-2222-AugMetric 111
10Rep A9/1/2022Sep-2222-SepMetric 19
11Rep A10/1/2022Oct-2222-OctMetric 1#REF!
12Rep A11/1/2022Nov-2222-NovMetric 1#REF!
13Rep A12/1/2022Dec-2222-DecMetric 1#REF!
14Rep A1/1/2022Jan-2222-JanMetric 216
15Rep A2/1/2022Feb-2222-FebMetric 211
16Rep A3/1/2022Mar-2222-MarMetric 214
Example Output File
Cell Formulas
RangeFormula
F2:F16F2=INDEX('Example Targets File'!$D:$O,MATCH($A2&$E2,'Example Targets File'!$A:$A,0),MATCH(D2,'Example Targets File'!$2:$2,0))
 
Upvote 0
How about
Excel Formula:
=INDEX('Example Targets File'!$E:$P,MATCH(F2,'Example Targets File'!$D:$D,0),MATCH(D2,'Example Targets File'!$E2:P2,0))
Although it will comeback as #N/A as the dates in one sheet are all 2023 & on the other sheet they are 2022
 
Upvote 0
Hey Mariett - you're on the right track, but your ranges are different sizes so the results of your MATCH formula are not going to align with the array of your INDEX formula.
So are yours ;)
 
Upvote 0
But the formula you posted has the same problem as you pointed out to the OP. ;) So possibly miss-leading.
 
Upvote 0
@Gimics @Fluff Great, thank you both! Didn't realize my example output file was using 2022 while my example targets tab had 2023 values 😁 In the real file, I'll be referring to two different 2022 and 2023 target tabs.

Thanks again!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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