Microsoft Excel: Using Lookup with another sheet - excel

At work I have a list of products with a unique product code and the manufacturers name.
In a separate document I have a list of products we have in the shop floor, as well as our custom name for that product.
I want to populate the manufacturers spreadsheet with our product name by performing some form of lookup.
I've merged the two Excel spreadsheets to that I have one document, 2 sheets.
Product code format is ABC1234.
ManSheet
ID | Manufacturer Name | Our Name
ABC1234 | Jolly | Jilly
OurSheet
ID | Our Name
ABC1234 | **=VLOOKUP(A1,'ManSheet'!A:A,2,FALSE)**
Could someone please help me with the formula.

VLOOKUP
First things first, you put the VLOOKUP on the sheet you wish to bring back the data to.
VLOOKUP syntax:
=VLOOKUP(Cell you wish to search,
range of cells you wish want to check,
Column on range with the value that you want to return,
Exact/Approximate match)
So on your "ManSheet" add another column:
ID | Manufacturer Name | Our Name | LookedUp Column
ABC1234 | Jolly | Jilly | =VLOOKUP(A2, Sheet2!A:B, 1, FALSE)
So your lookup should be something along the lines of this, you can then drag this cell down to populate the rows below and do a mass vlookup:
=VLOOKUP(A4, ManSheet!A:B, 2, FALSE)

Related

How to VLOOKUP an Excel Table in another Excel sheet

I am trying to VLOOKUP a value in an Excel Table and get the value from another Excel Table in another sheet.
the first table is called PRODUCTS and the second one is called PRODUCT DETAILS
In PRODUCTS I have:
GTIN-13 | SKU | NAME | PRICE
In PRODUCT DETAILS I have:
GTIN-13 | SKU | NAME | GW | NW
From PRODUCT DETAILS I am trying to Vlookup SKU from PRODUCTS and get the GTIN-13 value into PRODUCT DETAILS
GTIN-13 (PRODUCT DETAILS): =VLOOKUP([#SKU],PRODUCTS,1,)
But formula return #N/A.
I can't understand where I am mistaken
In PRODUCTS table, move SKU column to the leftmost of the table. So column order will be as below:
SKU | GTIN-13 | NAME | PRICE
In PRODUCT DETAILS table, use the below formula:
=VLOOKUP([#SKU],PRODUCTS,2,FALSE)
In this VLOOKUP formula, the number 2 indicates that you are trying to fetch the value from 2nd column (i.e. GTIN-13 is the 2nd col in PRODUCTS) when there is a match on SKU in the first column (VLOOKUP always tries to match values in the first column of your search range) in PRODUCTS.
Hope that helps!
VLOOKUP only works when the common column in both the table is on the left side of the desired values column.
You can just change the SKU column position to the left of GTIN-13 column and your formula will work fine.
Now if you don't want to tamper with the data tables and want more powerful lookup function, then you can use INDEX & MATCH functions.
INDEX takes 3 values - INDEX(Table, Row, Column)
MATCH takes 3 values - MATCH(Cell, Column, [-1, 0, 1]) ---- Here 0 is used to find the exact match
Now if you combine the both functions you can replace the Row of INDEX with the MATCH function.
It will be like this - INDEX(Table, MATCH(Cell, Column, 0), Column)
My formula in the sheet is INDEX(I:J, MATCH(D2, J:J, 0), 1)
Here I have used 1 as the Column of INDEX because I wanted the values of GTIN-13.

Excel Formula - Return unique count of range based on multiple criteria from different tables

I have three tables: Parties, Document Detail and Document. (Note, they are not table formatted, so all references are based on cell and sheet location, not table aliases)
I want to return a unique count of the parties in each Document using an Excel Formula. My problem is, I would usually use a =COUNTIFS() formula for this, which would be something like the following, which I would put in B2 of Sheet 3 (Document table):
=COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,Sheet1!A2)
But this will only return the count of one criteria at a time, not a count checking for all values of the parties table per document. I understand it should be able to be done with an array formula, but I can't figure it out. Bonus points if someone can figure out how to do it with a non-array formula!
Sheet1 - Parties Table
A
1|Parties |
+-----------------+
2|Education Officer|
3|Elder |
4|Family Support |
5|Interpreter |
Sheet2 - Document Detail Table
A B
1 |Doc ID | Party |
+-------+-----------------+
2 |FID0001|Education Officer|
3 |FID0001|Elder |
4 |FID0001|Education Officer|
5 |FID0001| |
6 |FID0001| |
7 |FID0002|Elder |
8 |FID0002|Interpreter |
9 |FID0002|Family Support |
10|FID0002| |
Sheet3 - (Desired Result) - Document Table
A B
1|Doc ID |Party Count|
+-------+-----------+
2|FID0001| 2 |
3|FID0002| 3 |
TL:DR
What combination of Excel formulas can I use to return the number of unique parties referenced in each document?
Based on this answer by Barry Houdini and expanded to include the DocID criteria
Put a helper column on Sheet2, lets say in colum C
=IFERROR(1/COUNTIFS($B:$B,$B:$B,$A:$A,$A:$A),0)
and copy down for all data rows
Then, in Sheet3 Party Count Formula is
=SUMIFS(Sheet2!$C:$C,Sheet2!$A:$A,$A:$A)
The non-Implicit Intersection versions
Sheet2 cell C1
=IFERROR(1/COUNTIFS($B:$B,$B1,$A:$A,$A1),0)
Sheet3 cell B2
=SUMIFS(Sheet2!$C:$C,Sheet2!$A:$A,$A2)

Excel VLookup #NV error

I'm trying to make a VLookup in Excel but I get everytime a #NV error.
This is table EVENTS:
This is table TRACK:
the formula on field F2 in table EVENTS is
=SVERWEIS(E2;TRACKS!$A$2:$B$52;1;FALSCH)
SVERWEIS is the word for VLOOKUP in the German version. FALSCH means wrong
As has been mentioned, VLOOKUP (SVERWEIS) can only look to its right to find a value to correspond with a value in the left hand columns of a table. The INDEX/MATCH combination is more flexible in this respect so if not to rearrange your columns I would suggest something like:
=INDEX(A:A,MATCH(E2,B:B,0))
where TRACK is assumed to be in ColumnsA:B. Converting to German, perhaps:
=INDEX(TRACKS!A:A;VERGLEICH(E2;TRACKS!B:B;0))
VLOOKUP compares the values in the first column of your reference target, you have your target values in the second.
Just swap VLOOKUP and the TEXT columns on your TRACKS sheet and it will work just fine.
Try switching the columns in TRACKS around.
VLOOKUP bases it's lookup on the first column, so in your case, it's looking through column A (1, 2, 3, etc.)
If you want your VLOOKUP to be based on the text, it needs to be in A instead.
i.e.
| A | B |
----------------------
1 | TEXT | VLOOKUP |
2 | Text1 | 1 |
3 | Text2 | 2 |
etc...
Then your function will be:
=SVERWEIS(E2;TRACKS!$A$2:$B$52;2;FALSCH)
Switching out the third argument because you now want the value from the second column

Excel multi column lookup

I am unsure how to Google this one. I have a table that looks like the below
Last Name | First Name | Team A | Team B | Team C
Smith | John | X | |
Doe | Jane | | X |
This would be the main sheet. The names in this sheet are divided into other sheet depending on what department they are in. Those sheets are setup in the same formats with the same columns. If the people in the main sheet are marked with an X in one of the columns I would like that same column marked in marked in the department sheets.
Your best bet might be to create a hidden column A where the value is a combination of column B and column C on all of your tabs. You could then use the standard VLOOKUP wrapped in an IFERROR clause.
For example,
=IFERROR(VLOOKUP(A1,Sheet1!A:F,3,False),"")
The IFERROR handles the instance that you may have a name on a sub tab not on the main tab. It returns blank instead of #N/A. The VLOOKUP is checking the value in A1 to what is in A1 on your main tab. A1 would be the combination of First and Last. The VLOOKUP would need to be in each of your team columns shifting the column returned number in each VLOOKUP.

Excel: Create Custom Sheet 2 Based on Data in Sheet 1

I have two sheets in a spreadsheet. Each sheet has a first column with common values (however they are not sorted the same and they are not all there in each sheet).
What I'm trying to do, if possible, is put a formula in sheet 2, where, if column 1 is a match for sheet 1, copies selective data from certain columns in that same row in sheet 1, to certain columns in sheet 2.
Example:
Sheet 1 has a heading setup and sample data row like this:
Title | Day of Week | First | Last
Supervisor | Wednesday | Mike | Jones
Sheet 2 has a heading setup and sample data row like this:
Title | Surname | Weekday
Supervisor | (empty cell) | (empty cell)
After running the mystery formula I'm looking for, placed in the 2 empty cells above, sheet 2 should match on the Supervisor key in sheet 1 and copy in data I have specified into each column, such as:
Title | Surname | Weekday
Supervisor | Jones | Wednesday
(In this case I have told it to map the "day of week" column to weekday, and map the "last" column to "surname").
I hope this is easy/possible??? Help???
VBA is not necessary. You can use a simple VLOOKUP:
=VLOOKUP(cell to look-up,
range where you want to look up the values (first column *must* contain the keys to look-up) including all columns that you want to retrieve,
the position of the column to be retrieved relative to the first column specified in argument 2,
0 (specifies you want an exact match))
For example:
=VLOOKUP(A1, Sheet1!$A$1:$D$150, 2, 0) ' Retrieves the 2nd column matching criteria in A1
Please notice, however, that you need your keys to be unique. Matching information based on the title seems a bit odd since it is likely there will be more than one person assigned to a certain role. For example, there may be more than 1 supervisor.
Use INDEX and MATCH (better than VLOOKUP).
I suggest renaming your headers so they match on both sheet.
Sheet 1 should be :
Title | Weekday | First Name | Surname
In sheet 2, cell B2 type in
=INDEX(Sheet1!$A:$D,match($A2,Sheet1!$A:$A,0),match(B$2,Sheet1!$1:$1,0))
You can drag and drop it in column C as well, it will work since you are using two MATCH functions with the cells properly anchored.

Resources