Jump to content
jugador

Excel (Index & Match) function

Recommended Posts

773557725_IndexMatch.JPG.18c54c405c98302b4af5f3272a7ed5dd.JPG

=INDEX($D$2:$E$11,MATCH(A2,$D$2:$D$11,0),2)

Have to use loop to do this or can be done easily by using <Excel.au3>

Share this post


Link to post
Share on other sites
Local $xlup = -4162
Local $iRow = $oWorkbook.ActiveSheet.Range("D65536").End($xlup).Row
Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 1)

Local $myRange = $oWorkbook.ActiveSheet.Range("D1:D11")

For $i = 2 To $iRow 
    If $aResult[$i-1] <> ""
        $var = $oExcel.Application.Match($aResult[$i-1], $myRange, 0)
        MsgBox(0, "", $var)
    EndIf
Next
Local $var, $oValue
Local $oRange = $oExcel.ActiveSheet.Range("D:D")
Local $iRow = $oExcel.WorksheetFunction.CountA($oRange)

Local $myRange = $oWorkbook.ActiveSheet.Range("D1:D11")

For $i = 2 To $iRow 
    If $oWorkBook.ActiveSheet.Range("A" & $i).Value <> ""  Then
        $var = $oExcel.Application.Match($oWorkBook.ActiveSheet.Range("A" & $i).Value, $myRange, 0) 
        $oValue = $oExcel.Application.Index($oWorkBook.ActiveSheet.Range("E1:E11").Value, $var, 1) 
        MsgBox(0, "", $oValue)
    EndIf
Next

 

Edited by jugador

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...