Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Macro for Match Index not working.

$
0
0
Hi,

HTML Code:

Database                                RESULT               
ID        Type        Record                ID        Type        Record
142163        2001        141780                142163        2001        141780
142118        2010        141780                142163        2010        141780
141461        3001        141780                142163        3001        141780
142094        3003        141780                142163        3003        141780
142094        3008        141780                142163        3008        141780
                                               
141791        1001        141481                141791        1001        141481
142264        1002        141481                141791        1002        141481
                                       
141928        1002        141895                141928        1002        141895
142159        3001        141895                141928        3001        141895
142062        2008        141895                141928        2008        141895
141493        3003        141895                141928        3003        141895
141596        1001        141895                141928        1001        141895
                                               
141494        1101        141950                141494        1101        141950
142281        1102        141950                141494        1102        141950

Code:

Sub Macro1()
 With Selection
 
.ClearContents
 .FormulaArray = _
 "=IFERROR(INDEX($A$1:$A$15,MATCH(C2,IF($B$1:$B$15=2001,$C$1:$C$15),0)),IFERROR(INDEX($A$1:$A$15,MATCH(C2,IF($B$1:$B$15=1001,$C$1:$C$15),0)),INDEX($A$1:$A$15,MATCH(C2,IF($B$1:$B$15=1101,$C$1:$C$15),0)))"
 
.Copy Selection.Offset(1).Resize(4)
 End With
 End Sub

The above Macro returns an Run time error '1004': Unable to set FormulaArray property of the Range class.

Please will some one help and modify to get the results.
I need this macro to generate the results from Col D2 and to be copied down as far as
there is contiguous data in column A.

Viewing all articles
Browse latest Browse all 13329

Trending Articles