Return data from multiple sheets using vlookup - excel

I would like a reference sheet1("Index") having A:A (ID#) and B:B (Sheetname). This project has several sheets referenced on sheet1 B:B
For simplicity, sheet1 B:B will reference sheet2("Assets") or sheet3("Locations"). I want to return data from sheet2 or sheet3 depending on sheet1 B:B reference.
Sheet2("Assets") has A:A (ID#), B:B (Description), C:C more info and so on. Sheet3("Locations") has similar data as Sheet2.
Using vlookup I would like sheet1 B:B to direct vlookup to either sheet2 or sheet3.
Normally I would use vlookup table array as follows:
=VLOOKUP(A2,Assets!$B:$C,2,FALSE) or
=VLOOKUP(A2,Locations!$B:$C,2,FALSE)
On sheet1 I've unsuccessfully tried
=VLOOKUP(A2,B2 & !$B:$C,2,FALSE)
How can I use sheet1 vlookup to return data found on multiple sheets?
Another question, is there a simpler way to replace vlookup data errors with blank cell. This is the formula I use:
=IF(IFERROR(VLOOKUP(A2,Assets!$B:$C,2,FALSE),"")<>"",IFERROR(VLOOKUP(A2,Assets!$B:$C,2,FALSE),""),"")

In C2 of your reference sheet, please try something like:
=VLOOKUP($A2,INDIRECT($B2&"!A:D"),COLUMN()-1,0)
copied across and down to suit.

Related

countifs help required. date filter is not matching in countifs

I tried to count the no. of cells which qualify 3 criteria however, it is not working in my case. Attached the Excel for your reference.
sheet1 first formula:
sheet1 second formula (which is not working):
Sheet2 table:

Excel VBA get dynamic values from a source sheet to destination sheet

I am new to VBA and I have been trying this for a while but so far no luck.
I have a workbook with 2 dynamic sheets 1 and 2. Each sheet has Column A(Tag ID),B(ID variation),C(values). I want to copy column C from sheet2 into column D of sheet1 if values of Column A&B in sheet1 match A&B of sheet2. There is also a chance that sheet 2 might not have all the entries for samples and only a portion of sample names will be available.
Any help is appreciated.
If Column C is just numeric data, then you could accomplish what you're trying to do without VBA and just use SumIfs or SumProduct.
Insert the below formula in your sheet1 cell D1 and drag down.
=SUMIFS(Sheet2!C:C,Sheet2!A:A,A1,Sheet2!B:B,B1)
Also, if you have Excel spill range feature, you could use a dynamic formula that would self-populate as rows are added.
=FILTER(SUMIFS(Sheet2!C:C,Sheet2!A:A,A1:A999999,Sheet2!B:B,B1:B999999),NOT(ISBLANK(A1:A999999)))
It sounds like you could create references to sheet 1 and 2, and loop through one of the sheets, while checking existence of each entry in the other sheet, and copying the value over if A&B match.
It's been a while since I've written VBA and this is not a great solution performance-wise, but this might help you get started.
Rough Example (definitely not syntactically correct, and is missing assigning sheet1 and sheet2 to the actual workbooks):
Dim sheet1 As Worksheet
Dim sheet2 As Worksheet
For row In sheet1
For row2 In sheet2
If row.Range("A").Value == row2.Range("A").Value
If row.Range("B").Value == row2.Range("B").Value
row.Range("D").Value = row2.Range("C").Value

Excel copy data from another sheet based on criteria

I have 2 Excel sheets and I want to copy data from sheet2 to sheet1
when the data in sheet1 is the same as in Sheet2
I tried Vlookup and INDEX-MATCH and i couldn't get them to work
Sheet1
Sheet2
I want to copy the Nr from Sheet2"B" to Nr in Sheet1"C" When the ID in sheet1 is the same as in sheet2.
Thanks in advance
My data in Sheet2 is:
And in Sheet2 I got:
The formula I've used in Sheet1 in Cell C2 (and then drag down) is:
=VLOOKUP(A2;Sheet2!$A$2:$B$5;2;FALSE)

Updating Sheet2 as I enter new data on Sheet1

I have some data on Sheet1 from B2:G5480. I also have the same data on Sheet2 from B2:G5480 for separate calculations.
What I want is as I enter new rows on Sheet1 updating Sheet2 automatically.
Any help will be appreciate.
Method 1:
Make cells in sheet2 point to cells in sheet1
For example in Sheet2 cell A1 have formula =Sheet1!A1
Replicate this principle across the range B2:G5480, being sure not to overwrite formula cells
Method 2:
Make formulae in Sheet2 refer to data in Sheet1 by prefacing cell references with Sheet1! - leave all data on sheet1 in just one place.

Excel creating additional sheets by copying but keeping formula

I have a workbook (we are using them for electronic purchase orders) and I need to be able to copy a worksheet but have the formula in it increment like it would if I copied the formula in a sheet.
In other words in sheet2 I1 the formula is ='Sheet1'!$I$1+1. When I copy sheet2 and it becomes sheet3, I need the formula in I1 to say ='Sheet2'!$I$1+1.
How can i do this?
You can get a string containing the current sheet name with the following formula
=cell("filename",A1)
If you are using the standard Sheet# for your pages, then you can get the current sheet number with this formula (assuming the previous one was in B3)
=RIGHT(B3,LEN(B3) - FIND("]Sheet",B3,1)-5)
Next calculate the number for the previous sheet
=VALUE(B4)+1
Now you can use the indirect function to address a cell in the previous sheet
=INDIRECT("Sheet"&B5&"!B1")
In Sheet4, this will reference B1 in Sheet3.
Copy it to Sheet5 and it will reference B1 in Sheet 4.

Resources