Index match formula with multiple matches

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
929
Office Version
  1. 365
Platform
  1. Windows
I have entered in the below index match formula multiple ways but I am still receiving a #N/A error when I know the result should be 21%
If anyone can point out what I am doing wrong it would be greatly appreciated!

Thank you!

First Formula Attempt:

Reprocesses Additional Data WP.xlsm
L
1#N/A
WO_Reprocess_Data
Cell Formulas
RangeFormula
L1L1=INDEX(WO_Reprocess_Data[% that were Operator Defects],MATCH(1,(WO_Reprocess_Data[Shipped Year]=Analysis!P2)*(WO_Reprocess_Data[Shipped Month]=Analysis!P1),0))


Second Formula Attempt:
Reprocesses Additional Data WP.xlsm
L
1#N/A
WO_Reprocess_Data
Cell Formulas
RangeFormula
L1L1=INDEX(F:F,MATCH(1,(B:B=Analysis!P2)*(A:A=Analysis!P1),0))
Named Ranges
NameRefers ToCells
Query_from_Uni_Inc__WP=WO_Reprocess_Data!$A$1:$C$39L1


Reprocesses Additional Data WP.xlsm
ABCDEFGHI
1Shipped MonthShipped YearCount of Work Orders ShippedCountCount over WO Shipped% that were Operator DefectsCostCount of All Reprocess and AdditionalsWO Interruptions
2Dec20192126124%31%$086410%
3Jan2020590244%21%$07312%
4Feb2020410236%4%$06716%
5Mar2020407246%25%$06917%
6Apr2020358319%35%$07220%
7May2020282166%31%$04717%
8Jun2020235209%15%$05925%
9Jul2020266166%38%$05220%
10Aug2020257177%35%$05321%
11Sep2020279218%38%$06122%
12Oct2020320268%35%$05317%
13Nov2020317237%48%$05618%
14Dec20202422310%48%$04719%
15Jan20212723814%39%$07327%
16Feb2021284186%56%$05118%
17Mar20213593911%44%$06318%
18Apr2021270249%21%$04617%
19May20212432410%33%$03916%
20Jun2021430276%59%$05312%
21Jul20212962910%45%$04917%
22Aug2021245187%44%$04217%
23Sep2021304186%61%$04314%
24Oct20212492912%31%$04518%
25Nov2021286279%30%$05419%
26Dec2021261177%24%$03413%
27Jan2022598224%59%$28,135386%
28Feb2022304155%40%$21,8504214%
29Mar2022328268%31%$31,0404915%
30Apr2022718233%17%$23,430527%
31May2022356278%52%$36,9065215%
32Jun2022369288%43%$33,7286417%
33Jul20223002910%55%$31,3458829%
34Aug2022409297%34%$31,2656616%
35Sep2022431317%23%$46,5606515%
36Oct20222713312%33%$54,6955320%
37Nov2022393297%41%$43,2305915%
38Dec20223123311%21%$49,7404715%
39Jan20231041817%50%$25,4553837%
WO_Reprocess_Data
Cell Formulas
RangeFormula
D2:D39D2=COUNTIFS(WP_RA[Rework Year],[@[Shipped Year]],WP_RA[Rework Month Name],[@[Shipped Month]],WP_RA[Additional/Reprocess],DATA!$A$1)
E2:E39E2=[@Count]/[@[Count of Work Orders Shipped]]
F2:F39F2=COUNTIFS(WP_RA[Rework Year],[@[Shipped Year]],WP_RA[Rework Month Name],[@[Shipped Month]],WP_RA[Additional/Reprocess],DATA!$A$1,WP_RA[Operator/Process],"Operator")/[@Count]
G2:G39G2=SUMIFS(WP_RA[Cost],WP_RA[Rework Month Name],[@[Shipped Month]],WP_RA[Rework Year],[@[Shipped Year]],WP_RA[Additional/Reprocess],DATA!$A$1)
H2:H39H2=COUNTIFS(WP_RA[Rework Year],[@[Shipped Year]],WP_RA[Rework Month Name],[@[Shipped Month]])
I2:I39I2=[@[Count of All Reprocess and Additionals]]/[@[Count of Work Orders Shipped]]


Reprocesses Additional Data WP.xlsm
OP
1Month Presenting:Dec
2Year Presenting:2022
Analysis
Cells with Data Validation
CellAllowCriteria
P1List=Categories!$D$1:$D$12
P2List=Categories!$K$1:$K$8
 
Last edited:
Glad to help & thanks for the feedback.
I received a reply from a SQL Forum and they stated that it was my formula in excel that was the problem and not the SQL code.

He stated the following:

"The problem doesn't appear to be the data - the problem is in the formula. That formula is expecting the year to be in a non-text format and fails because the column is defined as text.

If you are just refreshing the data in Excel - then the column data type shouldn't change. But - it sounds like you are not actually modifying the columns data type.

This doesn't appear to be an issue on the SQL side - rather a problem with the column definition in Excel and/or the formula. I would try fixing the formula so it converts the value from that column to a number - which can be done using VALUE or adding 0 to the column."

How would I fix the formula so it converts the value to a number / use value in this formula to avoid the error?
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I figured it out. The below formula now works:

=(INDEX(WO_Reprocess_Data[% that were Operator Defects],MATCH(1,(VALUE(WO_Reprocess_Data[Shipped Year])=Analysis!P2)*(WO_Reprocess_Data[Shipped Month]=Analysis!P1),0)))
 
Upvote 0
Solution
Personally I would disagree with whoever said it was the formula. Numbers should be imported as numbers & not as text, that is a basic rule of Excel.
 
Upvote 0
I am very confused. He is saying it is an excel table problem and no matter how I try and format or "cast" that line of SQL code the result is the same. I am just too new to SQL I think.
 
Upvote 0
If you are refreshing the query to an existing table, you can try this.

• Make sure you don't have any filters on your table.
• Hover over the heading of the Year field until you get a very dark downward pointing arrow and then click to select.
(or click in any cell in the Year field and hit Ctrl+Spacebar)
• Change the format to "General"

If you now refresh the query is Year being recognised as a number ?
 
Upvote 0

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

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