• 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.

lookup two values using vba

HI my dear team,
please help me in lookup two values using vba

please find the attachment.

thanks
 

Attachments

  • lookup two values for vba.xlsx
    389.3 KB · Views: 5
Something like!

Code:
Const strF As String = "=LOOKUP(,-1/(INDEX(main,,MATCH($A$1,main!$1:$1,0))=$A2)*(INDEX(main,,MATCH($B$1,main!$1:$1,0))=$B2),INDEX(main,,MATCH(C$1,main!$1:$1,0)))"

Sub Query()
With Sheets("fetch").Range("C2:E26")
    .Formula = strF
    .Value = .Value
End With
End Sub
 
Hi Deepak,

if addid and trascation id in fetch work sheet is found in main sheet the corresponding addcity,buyer city,subcategeory will come in to fetch sheet in dynamic way.please sea the red color formate in attachment.

Thanks
 

Attachments

  • lookup two values for vba.xlsx
    389.2 KB · Views: 3
Working Fine!!

You might not have assigned the named range "main" in the excel. Now named range will also get created in macro itself.

Check with attached!
 

Attachments

  • lookup two values for vba.xlsm
    396.8 KB · Views: 2
Back
Top