VLOOKUP through different sheets

Willie03

Board Regular
Joined
Jun 21, 2013
Messages
50
Hello I have a question on how to do a VLOOKUP on different sheets within the same workbook... Basically I would like to make a macro code to do the following:

1. Select Sheet PS
2. In cell D2 enter the Vlookup
3. Drag the formula down to the last row

I have this Vlookup but it return an error stating too many arguments and cant get it to work?

=IF(ISNA(VLOOKUP(A2,Regulares!J:L,3,0),ISNA(VLOOKUP('Temp Activos'!G:I,3,0),ISNA(VLOOKUP(A2,'Temp JA'!G:I,3,0),VLOOKUP(A2,'Temp Fit'!G:I,3,0)))))
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try this instead:
=IFERROR(VLOOKUP(A2,Regulares!J:L,3,0),IFERROR(VLOOKUP('Temp Activos'!G:I,3,0),IFERROR(VLOOKUP(A2,'Temp JA'!G:I,3,0),VLOOKUP(A2,'Temp Fit'!G:I,3,0))))

If you use ISNA you'll need additional if statements.
 
Upvote 0
Thanks for the response, just tried it and it works perfectly fine... As far as the macro I recorded this but I just had a question and I hope you may assist... As you can see from the code I have a count but the count needs to be edited to do the following: :confused:

1. filter the DL in column D:D and put the sum from column I in the Resultados sheet in cell B13
2. filter the IDL in column D:D and put the sum from column I in the Resultados sheet in cell B14

Code:
Option Explicit
Sub Calculate()

Dim count_DL As Integer, count_IDL As Integer, wbMetrics As Workbook

    Sheets("PS").Select
    Range("D2").Select
    ActiveCell.FormulaR1C1 = _
        "=IFERROR(VLOOKUP(RC[-3],Regulares!C[6]:C[8],3,0),IFERROR(VLOOKUP(RC[-3],'Temp Activos'!C[3]:C[5],3,0),IFERROR(VLOOKUP(RC[-3],'Temp JA'!C[3]:C[5],3,0),VLOOKUP(RC[-3],'Temp Fit'!C[3]:C[5],3))))"
    Range("D2").Select
    Selection.AutoFill Destination:=Range("D:D")
    Range("D:D").Select
    
    Columns("I:I").Select
        Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    
    Range("J2").Select
    Selection.FormulaR1C1 = "="
    ActiveWindow.WindowState = xlMaximized
    Range("J2").Select
    ActiveCell.FormulaR1C1 = "=SUM(C[-1])"
    Range("J3").Select
    
    'count_DL = Application.WorksheetFunction.CountIf(ActiveSheet.Range("D:D"), "DL")
    'count_IDL = Application.WorksheetFunction.CountIf(ActiveSheet.Range("D:D"), "IDL")
    
    'Worksheets("Resultados").Range("B13") = count_DL
    'Worksheets("Resultados").Range("C14") = count_IDL
    
    Sheets("Resultados").Select
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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