Help with INDEX and MATCH

Sean15

Well-known Member
Joined
Jun 25, 2005
Messages
719
Office Version
  1. 2010
Platform
  1. Windows
Hi:

Please see below.

Excel 2010 is returning #NA for lookup values.

The required value for 204 is 1, 115 is 3, and 6.

Could you advise please?



Excel 2010
EFGHIJKLM
5Bldg #BayBayBayBayBayBayBayBay
61101102103104105106
71201202203204205206
81301302303304305306
92207208209210211212213214
102107108109110111112113114
113115116117118119
123215216217218219
133315316317318319
144121122123124125126
154221222223224225226
164321322323324325326
175127128129130131132
185227228229230231232
195327328329330331332
206133134135136137138
216233234235236237238
226333334335336337338
23
24
25BayBldg
26204#N/A
27115#N/A
28338#N/A
Sheet1 (2)
Cell Formulas
RangeFormula
G26=INDEX($E$6:$E$22,MATCH(F26,$F$6:$N$22,0))
G27=INDEX($E$6:$E$22,MATCH(F27,$F$6:$N$22,0))
G28=INDEX($E$6:$E$22,MATCH(F28,$F$6:$N$22,0))



Thanks,

Sean
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Sean,

MATCH() only works on one row or one column but not on a range.
Code:
=AGGREGATE(15,6,$E$6:$E$22/($F$6:$M$22=F26),1)
 
Upvote 0
or use PowerQuery

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Bldg #", Int64.Type}, {"Bay", Int64.Type}, {"Bay2", Int64.Type}, {"Bay3", Int64.Type}, {"Bay4", Int64.Type}, {"Bay5", Int64.Type}, {"Bay6", Int64.Type}, {"Bay7", Int64.Type}, {"Bay8", Int64.Type}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Bldg #"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"})
in
    #"Removed Columns"
Code:
let
    Source = Table.NestedJoin(Table2,{"Bay"},Table1,{"Value"},"Table1",JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Bldg #"}, {"Bldg #"})
in
    #"Expanded Table1"

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#70AD47]Bay[/td][td=bgcolor:#70AD47]Bldg #[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]
204​
[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
115​
[/td][td]
3​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]
338​
[/td][td=bgcolor:#E2EFDA]
6​
[/td][/tr]
[/table]
 
Upvote 0
In G26
Code:
=INDEX($E$6:$E$22;SUMPRODUCT(--($F$6:$M$22=F26)*ROW($F$6:$M$22))-ROW($F$6:$M$22)+1)
and copy down.

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
E​
[/td][td]
F​
[/td][td]
G​
[/td][td]
H​
[/td][td]
I​
[/td][td]
J​
[/td][td]
K​
[/td][td]
L​
[/td][td]
M​
[/td][/tr][tr][td]
5​
[/td][td="bgcolor:#0070C0"]Bldg #[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bay[/td][/tr]
[tr][td]
6​
[/td][td]
1​
[/td][td]
101​
[/td][td]
102​
[/td][td]
103​
[/td][td]
104​
[/td][td]
105​
[/td][td]
106​
[/td][td][/td][td][/td][/tr]
[tr][td]
7​
[/td][td]
1​
[/td][td]
201​
[/td][td]
202​
[/td][td]
203​
[/td][td="bgcolor:#FFD9D9"]
204
[/td][td]
205​
[/td][td]
206​
[/td][td][/td][td][/td][/tr]
[tr][td]
8​
[/td][td]
1​
[/td][td]
301​
[/td][td]
302​
[/td][td]
303​
[/td][td]
304​
[/td][td]
305​
[/td][td]
306​
[/td][td][/td][td][/td][/tr]
[tr][td]
9​
[/td][td]
2​
[/td][td]
207​
[/td][td]
208​
[/td][td]
209​
[/td][td]
210​
[/td][td]
211​
[/td][td]
212​
[/td][td]
213​
[/td][td]
214​
[/td][/tr]
[tr][td]
10​
[/td][td]
2​
[/td][td]
107​
[/td][td]
108​
[/td][td]
109​
[/td][td]
110​
[/td][td]
111​
[/td][td]
112​
[/td][td]
113​
[/td][td]
114​
[/td][/tr]
[tr][td]
11​
[/td][td]
3​
[/td][td="bgcolor:#FFD9D9"]
115
[/td][td]
116​
[/td][td]
117​
[/td][td]
118​
[/td][td]
119​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
12​
[/td][td]
3​
[/td][td]
215​
[/td][td]
216​
[/td][td]
217​
[/td][td]
218​
[/td][td]
219​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
13​
[/td][td]
3​
[/td][td]
315​
[/td][td]
316​
[/td][td]
317​
[/td][td]
318​
[/td][td]
319​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
14​
[/td][td]
4​
[/td][td]
121​
[/td][td]
122​
[/td][td]
123​
[/td][td]
124​
[/td][td]
125​
[/td][td]
126​
[/td][td][/td][td][/td][/tr]
[tr][td]
15​
[/td][td]
4​
[/td][td]
221​
[/td][td]
222​
[/td][td]
223​
[/td][td]
224​
[/td][td]
225​
[/td][td]
226​
[/td][td][/td][td][/td][/tr]
[tr][td]
16​
[/td][td]
4​
[/td][td]
321​
[/td][td]
322​
[/td][td]
323​
[/td][td]
324​
[/td][td]
325​
[/td][td]
326​
[/td][td][/td][td][/td][/tr]
[tr][td]
17​
[/td][td]
5​
[/td][td]
127​
[/td][td]
128​
[/td][td]
129​
[/td][td]
130​
[/td][td]
131​
[/td][td]
132​
[/td][td][/td][td][/td][/tr]
[tr][td]
18​
[/td][td]
5​
[/td][td]
227​
[/td][td]
228​
[/td][td]
229​
[/td][td]
230​
[/td][td]
231​
[/td][td]
232​
[/td][td][/td][td][/td][/tr]
[tr][td]
19​
[/td][td]
5​
[/td][td]
327​
[/td][td]
328​
[/td][td]
329​
[/td][td]
330​
[/td][td]
331​
[/td][td]
332​
[/td][td][/td][td][/td][/tr]
[tr][td]
20​
[/td][td]
6​
[/td][td]
133​
[/td][td]
134​
[/td][td]
135​
[/td][td]
136​
[/td][td]
137​
[/td][td]
138​
[/td][td][/td][td][/td][/tr]
[tr][td]
21​
[/td][td]
6​
[/td][td]
233​
[/td][td]
234​
[/td][td]
235​
[/td][td]
236​
[/td][td]
237​
[/td][td]
238​
[/td][td][/td][td][/td][/tr]
[tr][td]
22​
[/td][td]
6​
[/td][td]
333​
[/td][td]
334​
[/td][td]
335​
[/td][td]
336​
[/td][td]
337​
[/td][td="bgcolor:#FFD9D9"]
338
[/td][td][/td][td][/td][/tr]
[tr][td]
23​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
24​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
25​
[/td][td][/td][td="bgcolor:#0070C0"]Bay[/td][td="bgcolor:#0070C0"]Bldg#[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
26​
[/td][td][/td][td="bgcolor:#FFD9D9"]
204
[/td][td="bgcolor:#FFFF00"]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
27​
[/td][td][/td][td="bgcolor:#FFD9D9"]
115
[/td][td="bgcolor:#FFFF00"]
3​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
28​
[/td][td][/td][td="bgcolor:#FFD9D9"]
338
[/td][td="bgcolor:#FFFF00"]
6​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Upvote 0
@shift-del, strooman - thank you very much.
@sandy666 - I have never used PowerQuery but thanks for your insight.

Sean
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
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