How to index match with multiple different columns

Hmill

New Member
Joined
Jun 23, 2022
Messages
26
Office Version
  1. 2016
Platform
  1. Windows
I have been using an index match to pull data from a query to one of my spreadsheets. At first I was just having my query pull one day at a time so it was pretty simple. Now, I am having the query pull data from March till present and I need to index match my spreadsheet with multiple different columns to get the right data. Is there a way to do this.

This what the query looks like:
1656336722363.png


This is how I'm organizing data in spreadsheet:
1656336795433.png


This was my formula to index match when I was doing it one day at a time:

For cell B2:
=IFNA(IF($A2=Query3!$C$2,INDEX(Query3!$A:$A,MATCH(T!$B$1:$G$1,Query3!$B:$B,)),B2),0)
 
That sounds good. It works fine in my workbook. For reference, here is the Query3 worksheet I set up:
MrExcel_20220626.xlsx
ABC
1Number CompletedCal LabDate Completed
23Dimen3/16/2022
34Health Physics3/16/2022
44MAA Electrical3/16/2022
510Physical3/16/2022
63Torque3/16/2022
71Dimen3/17/2022
81Health Physics3/17/2022
92MAA Electrical3/17/2022
104Physical3/17/2022
119Torque3/17/2022
122Dimen3/18/2022
137Electrical3/18/2022
141Health Physics3/18/2022
152MAA Electrical3/18/2022
167Physical3/18/2022
Query3

...and the results on Sheet2:
MrExcel_20220626.xlsx
ABCDEFGH
1DimenElectricalHealth PhysicsMAA ElectricalPhysicalTorqueTotal
23/16/2022304410324
33/17/202210124917
43/18/202227127019
53/19/20220000000
Sheet2
Cell Formulas
RangeFormula
B2:G5B2=IFNA(INDEX(Query3!$A$2:$A$16,MATCH(1,(Query3!$B$2:$B$16=B$1)*(Query3!$C$2:$C$16=$A2),0)),0)
H2:H5H2=SUM(B2:G2)
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Yeah, that's bizarre. I don't know if the data being from a query is what's causing the issue or what. I don't see why it would though.
 
Upvote 0
Depending on what is supplying the data, it is possible that some hidden characters are included. One quick check for this is to examine the length of text strings to see if the results make sense. For example, =LEN(Query3!B2) where we see "Dimen", we should expect a result of 5. If a different result is obtained, some non-printing characters may have been imported with the query, and those will need to be identified and cleaned. But you had a simpler version of this working before, correct? So it seems unlikely that this would be the issue.
 
Upvote 0
Hey, I figured out the issue! Because this is an array formula, it must be entered with control + shift + enter, except in Excel 365. So it works now
 
Upvote 0
Oh...sorry. I completely neglected to mention that. Here is another idea that should not require entering as an array formula:
MrExcel_20220626.xlsx
ABCDEFGH
1DimenElectricalHealth PhysicsMAA ElectricalPhysicalTorqueTotal
23/16/2022304410324
33/17/202210124917
43/18/202227127019
53/19/20220000000
6
73/16/2022304410324
83/17/202210124917
93/18/202227127019
103/19/20220000000
Sheet2
Cell Formulas
RangeFormula
B2:G5B2=IFNA(INDEX(Query3!$A$2:$A$16,MATCH(1,(Query3!$B$2:$B$16=B$1)*(Query3!$C$2:$C$16=$A2),0)),0)
H2:H5,H7:H10H2=SUM(B2:G2)
B7:G10B7=SUMPRODUCT(Query3!$A$2:$A$16,(Query3!$B$2:$B$16=B$1)*(Query3!$C$2:$C$16=$A2))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,819
Messages
6,181,153
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