How to input two arrays in VLOOKUP? - excel

I have a worksheet in Excel 2013 with two sheets: Sheet 1 and Sheet 2. I am applying a formula in both the sheets in the same column (G). The data is in more than 100,000 rows that's why I can't put it in one sheet only.
The problem is that I want to use VLOOKUP in both sheets in a way that the function looks up in both sheets in the same columns (arrays) i.e. A and B columns in sheet 1 and sheet 2 and get the value from column B i.e. column 2 within VLOOKUP function.
How can I add reference to the other sheet?

I doubt a complete solution is possible with VLOOKUP because, for instance, the corresponding ColumnB values may differ even where a ColumnA value is the same on both sheets. So without VBA (or possibly merging your sheets) you may have to compromise, so I offer only a partial solution, based on Excel 2007.
This 'looks up' in the 'other' sheet and only defaults to the 'same' sheet where the first attempt is unsuccessful. It uses INDEX and MATCH because likely quicker than VLOOKUP for high volumes. The formula I have applied for Sheet1 (in G1 and to be copied down) is:
=IFERROR(INDEX(Sheet2!B$1:B$6,MATCH(E1,TwoArray,0)),INDEX(B$1:B$7,MATCH(E1,OneArray,0)))
where the OneArray and TwoArray are named ranges for parts of ColumnA for the two sheets and the link values are expected in ColumnE (the formula in Sheet2 is similar):

Related

Filter rows from multiple sheets in Excel without VBA

I have an Excel file with three sheets, with data in each sheet organised in the same manner - headers are the same.
Without using VBA (as macros are not allowed by my organisation's security policy), I would like to find all rows from all sheets that meet a simple column value check and show those rows in a separate sheet.
For example:
Sheet2 has,
Sheet3 has,
Sheet4 has,
I want sheet1 to have all rows from sheets 2-4 with Header7 column value = "Hit",
What I have achieved so far is, using an array formula I could get all the "hits" from one sheet in sheet1.
The formula for A2 to A6 in sheet1 is as below, with the ROW(1:1) changing to ROW(2,2) and so on from A3 onwards. Columns B to G use the same formula with range adjusted accordingly.
{=IFERROR(INDEX(Sheet4!$A$2:$A$6,SMALL(IF(Sheet4!$G$2:$G$6="Hit",ROW(Sheet4!$A$2:$A$6)),ROW(1:1))-1,1),"")}
What this does is a bit complicated. In short, it creates an array of either FALSE or row numbers based on Hit and then finds the index of the non-false values.
Now, I can solve the last part of combining the idea to include all sheets in two ways (I think).
Have another temporary sheet (sheet5) with all rows from sheets 2 to 4. Update my formula in sheet1 to use sheet5 instead of 4.
Have the range Sheet4!A2:A6 etc changed to include a 3D reference like Sheet2:Sheet4!A2:A6. But this doesn't work, and the documentation for 3D reference doesn't mention that it works with array functions.
PS: I don't have Power Query, which seemed to have an easy way to create a new sheet with all rows from multiple sheets, because I work on a Mac (MS Excel for Mac).

Excel VLOOKUP and getting data from another sheet

I work in office Excel online at it seems it is different than "regular" office. I have a standard case of two excel sheets that contain two matching columns both A columns (starting with 2 row, first is title of row). In first sheet I need to add second column value from second sheet where values from A match. This seems easy but, for some reason in online office this simple formula does not work:
=VLOOKUP(A2,Sheet2!$A$2:$B$4170,2,0)
this gives just N/A result although matching value in Sheet2 exists.
Column is in both sheets A, with title sku in row 1. Second sheet contains additional data in column 2 (B) which I want to put in F column of Sheet1 using this formula.
Can you tell me why this doesn't work? IS office.com different in term of formulas?
Also, when I pull down this formula this A starting number in "Sheet2!$A$THISNUMBER" gets bigger, like
=VLOOKUP(A3,Sheet2!$A$3:$B$4170,2,0)

Using internal excel sheet name (i.e. sheet1, sheet2, sheet3) to sum a cell across multiple sheets

I'm trying to sum the same cell across multiple sheets. The number of sheets increases by one each week and will be a new Sheet1. Each sheet will get a date for it's name. The last sheet will have the sum totals. The three sheets prior to that will contain instructions. i.e. 20 sheets, data on sheets 1-16, instructions on sheets 17-19 and totals on sheet 20.
This Sum across dynamic number of sheets question uses a User-defined Function, =autosum, in each cell and could work. I would rather use VBA to create a macro. I know how to get total sheets and sum across all the sheets, where I'm lost is how to sum across (total sheets -4), i.e. sheets 1-16.
code I'm already using is
Dim sheets as Integer
sheets = Application.sheets.Count
=SUM('FirstSheet:LastSheet'!D6)
How do I get
=SUM('FirstSheet:(LastSheet-4)'!D6?
I want to use the internal excel sheet1, sheet2, etc. vs the date name on each sheet, at least for FirstSheet. I can hardcode LastSheet since it won't change.
You shouldn't need to use VBA, you can use the default sum formula. I recommend creating two blank sheets (e.g. "Start" and "End"), ensure that "Start" is always before the first sheet you want to some and "End" is always immediately after the last sheet you want to sum. Then, a formula like this would do what you're asking:
=SUM(Start:End!A1)
Edit: If the name of the first and/or last sheet that should be summed is static, you could avoid using the "start" or "end" placeholders and replace them with the names of the first/last sheets that should be summed.

How to change this Excel formula

i have this formula to get data to one sheet from another sheet.
But i need to have a formula that will get data from all the sheets between sheet "start" and sheet "end" i have about 80 sheets.
Thank you.
= COUNTIF(Huvudlager!$B:$B;"Skruvdragare")
There is not a clean and easy way to do this all in one cell.
You can however, take advantage of some nifty excel functions to help you with this, namely GET.WORKBOOK and INDIRECT.
Step 1
Define a Named Range called SheetList (or whatever you want) with the following formula:
=SUBSTITUTE(GET.WORKBOOK(1),"["&GET.WORKBOOK(16)&"]","") creates an array of worksheet names within the workbook. The substitute function gets rid of the workbook name in the array.
Step 2
Highlight 80 rows (since you said you have 80 sheets) of data on the sheet where you wish to count your data. Then type =TRANSPOSE(SheetsList) into the first cell and Ctrl+Shift+Enter. Your sheet list will appear in the 80 rows. Transpose is needed so the list goes down the rows instead of across columns.
Step 3
Write the following formula next to each sheet =COUNTIF(INDIRECT(A1&"!$B:$B"),"Skruvdragare") assumes first sheet name is A1.
Edit: You'd be better served to define the row ranges in the COUNTIF formula, since counting every row in a column is very efficient, especially if not all the rows have data. So, use the max number of rows you know will have data across all the sheets, for example: INDIRECT(A1&"!$B$1:$B$1000")
Step 4
Write a formula to sum the counts of each sheet.

Merging 2 sheets based on 1 column

I have two sheets which are in one Excel file.
Sheet1 has style numbers with quantities
Sheet2 has style numbers with different quantities.
Most of the style numbers match in both sheets (and they are both sorted alpha) but there are some styles that exist in one sheet and not the other and vice versa.
What is the best way to automatically merge the 2 sheets based on style number, and then add the rows from sheet1 that are not found in sheet 2 as well?
Is it with a vlookup? I know I can use vlookup but then the columns that are not a match in both sheets won't be copied over and I won't know.
You could use 2 VLOOKUPs, one to get the data from sheet2, and one in sheet2 to identify the numbers not found in sheet1 (by putting a filter on all the cells that return #N/A).

Resources