• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macro index and match not working

RAM72

Member
Hi All

macro index and match not working but formula working can someone help
Giving results in column macro 1,1,1,1,1,1,1,1,1,
Formula giving correct results

Code:
Sub testitemised()
    Dim LRS As Long
    Dim LRW As Long
    With Worksheets("Summary Report ")
        LRS = .Range("A" & .Rows.Count).End(xlUp).Row
    End With
    With Worksheets("Workings")
        LRW = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("O2:O" & LRW).FormulaArray = _
            "=INDEX('Summary Report '!R2C7:R" & LRS & "C7,MATCH(RC[-7]&RC[-6]&RC[-5],'Summary Report '!R2C1:R" & LRS & "C1&'Summary Report '!R2C2:R" & LRS & "C2&'Summary Report '!R2C3:R" & LRS & "C3,0))"
    End With
End Sub


Formula

Code:
=INDEX('Summary Report '!$G$2:$G$124,MATCH(H2&I2&J2,'Summary Report '!$A$2:$A$124&'Summary Report '!$B$2:$B$124&'Summary Report '!$C$2:$C$124,0))
 

Attachments

  • TESTafter SUMPRODUCTMACRO(1).xlsm
    192.1 KB · Views: 5
Check this...


Code:
Sub testitemised()
    Dim LRS As Long
    Dim LRW As Long
    With Worksheets("Summary Report "):        LRS = .Range("A" & .Rows.Count).End(xlUp).Row:    End With
    With Worksheets("Workings")
        LRW = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("o2").FormulaArray = "=INDEX('Summary Report '!$G$2:$G$" & LRW & ",MATCH(H2&I2&J2,'Summary Report '!$A$2:$A$" & LRW & "&'Summary Report '!$B$2:$B$" & LRW & "&'Summary Report '!$C$2:$C$" & LRW & ",0))"
        .Range("o2:o" & LRW).FillDown
    End With
End Sub
 
Last edited:
Back
Top