Multiple Vlookup for identifying a customers name or business - excel

I want to create a multiple vlookup to match records on an ID from two sheets. If the column reference does not exist I want it to look at a different column.
This is what I have already:
=IF(VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,0)>0,VLOOKUP(A2,'Roots data'!
F$2:Y$1139,17,0))
18 being the column which I want to check first and 17 being the column I want to check second. Can you please advise why this is not working appropriately?
Sample data:
Table 1:
ID First Name Last Name Age/Road
1 James John
2 John Miller
Table 2:
ID Age Address
1 21 1 Road
2 22 2 Road
In this example, if I wanted to find the Age of ID 1 which is James I would do a vlookup to identify this, if the age was not present I instead would want to know the address for ID 1, to be populated under Age/Road in Table 1.

I believe this is what you are looking for:
=IF((VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,FALSE)=0),VLOOKUP(A2,'Roots data'!F$2:Y$1139,17,FALSE), VLOOKUP(A2,'Roots data'!F$2:Y$1139,18,FALSE))

Related

Updating spreadsheet after altering the original one

I have the following data in spreadsheet A.
name trait1 trait2 nice
0 Adam 29 81 0
1 Barry 17 75 1
2 Chris 62 0 1
I wish to create a spreadsheet B that will be a filtered copy of this data. Namely, let's assume for a moment that I want to filter nice = 1 and am interested only in column name. The copy in spreadsheet B would be as shown below. In spreadsheet B I wish to be adding some extra columns, e.g. education.
name nice education
1 Barry 1 primary
2 Chris 1 university
What I want to achieve is a spreadsheet B that will get updated if anything changes in spreadsheet A. So for example, if I were to change the name Barry to Ben. The spreadsheet B would become the following.
name nice education
1 Ben 1 primary
2 Chris 1 university
Similarly (and what I find to be the hardest), if a row is added in spreadsheet A, e.g.
name trait1 trait2 nice
0 Adam 29 81 0
1 Barry 17 75 1
2 Matt 69 11 1
3 Chris 62 0 1
The updated spreadsheet B would be as follows:
name nice education
1 Barry 1 primary
2 Matt 1
3 Chris 1 university
So I want the education column to remain the same.
My approach of using a combination of =IF() and =VLOOKUP() functions ultimately did not work. Guess I am really curious about how to connect rows of education to names. So that when a row is added in spreadsheet A, then spreadsheet B gets updated but the education field connected to the new row is empty and will be filled by hand later on.
Since you are looking for a finished product to be in Google Sheets, I'd advise to use QUERY():
Formula in I1:
=QUERY(INDEX({A:D,VLOOKUP(A:A,F:G,2,0)}),"Select Col1,Col4,Col5 where Col4=1")
Note: I made the assumption you pull the education in through a VLOOKUP() (since you mentioned that in the body of the question).

Lookup and return values to duplicates

I have two tables exported out of our ERP system. The data is related but one of the tables does not include the customer ID. One table is the customer master list, the other is a list of card numbers assigned to customers. For example:
Master list: ID and Name
1 Bill
2 Sam
3 Tim
Other list: Name and Card number
Bill 1234
Bill 1456
Bill 6743
Sam 3333
Tim 5555
Tim 5678
I want the customer ID to return next to each of their card number entries. Like:
1 Bill 1234
1 Bill 1456
1 Bill 6743
2 Sam 3333
3 Tim 5555
3 Tim 5678
I've been trying to do a VLOOKUP and an IF statement with VLOOKUP but I can't get the ID to display when returning a value to multiple entries.
Is there a way to do this?
Use INDEX and MATCH for this. See my example and replace my german VERGLEICH with MATCH, INDEX should be the same.

LOOKUP function in Excel to search values on left and right

The scenario I'm facing is that in my company we have mixed naming conventions for servers and workstations like:
COUNTRYCODE-WORKSTATION1
WORKSTATION10-COUNTRYCODE
COUNTRY-SERVER1
SERVER1-COUNTRYCODE
So sometimes I may find names like: BR-WK1 or SRV42-US.
I need to create a PivotTable to extract the amount of events per country so I need to come up with a Lookup function that looks at the first two characters in a cell and if it finds a country code it returns the country code in a country column for that row. If it does not find a country code, it looks at the first two characters on the right, and so on. Country code list will be available in another sheet.
IF(LEFT(CELL,CHARNUMBER){COUNTRY LIST}) then (CELLCOUNTRY == {MATCH COUNTY}))
ELSE(RIGHT(CELL,CHARNUMBER){COUNTRY LIST} then (CELLCOUNTRY == {MATCH COUNTRY}))
Excel:
COUNTRY MACHINE NAME EVENT DATE TIME
BR BR-WK1 Critical type 1 08/01/2015 01:15
US SRV42-US Critical type 2 08/01/2015 01:15
BR WK100-BR Warning type 8 08/01/2015 01:15
US US-SRV420 Critical type 1 08/01/2015 01:15
Pivot table:
Row Labels Count of EVENT
BR 2
US 2
Grand Total 4

Marking Duplicate Values based on additional cell.

I am looking for a way, preferable formula based, to mark if a value(name) is present in a spreadsheet more than one time based on a difference in the order# in a different column. As there are multiple lines per order some names will have the same order# on multiple lines but I do not want to mark those only if there are multiple order#s for a person. Example below (new so might not be best formatting for site, sorry.) Thanks
ORDER# LN QTY ITEM LOC NAME DUPLICATE
OD10560 1 24 part#12 Location 1 Joe John Marked
OD10559 1 1 part#114 Location 2 Bunny Johnson Marked
OD10569 1 3 part#444 Location 1 Joe John Marked
OD10567 1 3 part#777 Location 2 Archy Bunker
OD10567 2 4 part#123 Location 2 Archy Bunker
OD10562 1 24 part#458 Location 1 Kay Harrison
OD10577 1 2 part#471 Location 2 Bunny Johnson Marked
OD10577 2 1 part#736 Location 2 Bunny Johnson Marked
OD10563 1 2 part#778 Location 1 Mark Riddle
OD10579 1 2 part#3347 Location 1 Terry Clark
COUNTIFS will allow you to see how many orders a person has, not including the current one.
The formula for MARKED would be:
=COUNTIFS($F$2:$F$11,F2,$A$2:$A$11,"<>"&A2)
in G2, and drag down.
This will count the lines where the person has the same name, but a different order. You can simply mark those that are greater than 0.
Note that this will show the second line as 2, as Bunny Johnson has 2 lines with different orders (it counts both of the other lines, as they have different order numbers, even though both of those lines have the same order). This does not alter the result in any way, just explaining why it shows 2 instead of 1 for everyone else
You could use the =COUNTIF(range, criteria) and just see if there are more than 1 counted.
Its pretty simple if you just take all of your names as the range and criteria is your name on the line you are looking at

Index/match with two criteria anyway to get the second set of data using unique identifiers?

I've been stuck for some time trying to match up two different data spread sheets. I'm trying to match off dollar amounts with matching names that correspond to the dollar amount. I went ahead and assigned unique identifiers to each row thinking that would help me match off the amounts, but my problem comes when there are two or more dollar amounts that are the same and have the same name.. is there anyway to get the second id to show up?
Formula sheet: (I need The second 112 to pull 113.. anyway thats possible??
A B C D E F G
IDSheett2 IDsheet1 NameSheet1 NameSheet2 Item AmountSheet1 AmountSheet2
554 112 Jim Jim Hat 25 25
555 112 Jim Jim Shoe 25 25
Formula in column B2: it should go through both sheet 1 and 2 and automacially fill in the matching id - id that matches the name and amount.
=IFERROR(INDEX(sheet1!$C$2:$C$1000,MATCH(1,INDEX((sheet1!$A$2:$A$1000=D1)*(sheet1!$B$2:$B$1000=G1),0,1),0)),"")
Data from Sheet2:
A= ID B= Name C= Item Name ( ID basically row 1 = 1, 2 = 2.. )
A B C D
554 Jim Hat 25
555 jim Shoe25
Data from Sheet1:
A= name B= amount C= assigned ID ( ID basically row 1 = 1, 2 = 2.. )
A B C
Jim 25 112
Jim 25 113
I'm also open to other ideas. Thanks for the help.
UPdated::: Based on comments
im not trying to create a database.. i have two sets of data that i'm trying to compare and match off like items(i take matched items and email it out to a group of people). i had to change some of the names because this is work related but the overall concept should remain.
it is Impossible for me to know how many names will be on incoming wires and how many names will be on my expected wires lists. I assigned unique ids per row on each page so i can do iferror/index/match to pull from a unique row to the main page.
What im trying to accomplish:
I have two sets of data: Sheet1 is incoming wires (it gives me a name and an amount) Sheet 2 is the account name, Item its for, and expected amount.
I'm trying to match the name and amount on the formula sheet but i run into the problem of two items with the same name and the same amount only pulling the first ID number it runs into and this becomes a problem because i have another vba code that will delete multiple ID's so i know i'm not counting something twice.
my final page should read:
ID sheet2 IDsheet1 Name Item(sheet2) Amount
554 112 JIM Hat 25
555 113 JIM Shoe 25
but right now the 113 id wont pull and it will just be 112 twice (which will end up getting deleted so i will miss that second match)
..+ everything works perfectly unless there are two items for the same name and the same amount +.. that is the only time i run into this problem.
Is there any code or process that can have the sheet realize that it has already used the ID of 112 once and then automatically fill in the id of 113 (so it won't get deleted by my vba code)?
In your formula sheet, B2 and copied down:
=IFERROR(INDEX(Sheet1!$C$2:$C$1000,MATCH(1,INDEX((Sheet1!$A$2:$A$1000=D2)*(Sheet1!$B$2:$B$1000=G2)*(COUNTIF(B$1:B1,Sheet1!$C$2:$C$1000)=0),),0)),"")

Resources