Vlookup from another sheet using multiple columns - excel

I have an excel workbook with 2 sheets.
Sheet 4 and Sheet 5:
Sheet 4 has the following columns:
type model name year
U acura jane 1998
D honda peter 2002
U bmz fred 1993
Sheet 5 also has the same columns but with an additional column sales.
type model name sales
U acura jane 2.3
D honda peter 3.8
U bmz fred 19
IN both the sheets, I created an additional column called "key" concatenating type-model-name (A2&B2&C2)
type model name year key
U acura jane 1998 Dacurajane
D honda peter 2002 Dhondapeter
U bmz fred 1993 Dbmzfred
To get the sales in Sheet1, I am giving the following vlookup.
=VLOOKUP(E2|Sheet5!A2:F4|5|FALSE)
I looked at other similar answers, trimmed the columns and did what the recommendations were, but it still returns #N/A
Can anyone point out what my mistake it?
Thanks In advance.

Use INDEX/MATCH
=INDEX(Sheet5!D:D, MATCH(E2, Sheet5!A:A&Sheet5!B:B&Sheet5!C:C, 0))
Enter with Ctrl-Shift-Enter
Also I am assuming that the sales is in column D of Sheet5. If different, put the appropriate column in as first parameter to the INDEX function.
Also please consider using restricted range references in the match function, instead of full column references - for speed & efficiency.

on cell E1 you will have KEY on cell E2 you will place =CONCATENATE(A2,B2,C2,D2) Combines contents above into a phrase "DFocusManuel2016". That should work for the combine part just paste that and drag down as desired on E2.
You can cover the rest of the cell population by simply assigning links to the cells so on cell A2,B2,C2 and D1 you will have =SHEETNAME!Y10 which Y10 corresponds to the source cell and Sheet name to the source sheet.

Related

Ranking Duplicate String Values in Excel

I have a spreadsheet with string values and need to create a column with the rank (without using the rank function) of the duplicate values from another column.
Please see below for example of the desired outcome where Dupe_Rank is the created column.
Thanks!
Name
Dupe_Rank
John
1
John
2
Dave
1
John
3
Bill
1
Dave
2
let's say "Name" starts from column 'A' and row 2 as in below figure:
then add this formula:
=COUNTIF(A$2:A2,A2)
to cells below Dupe_Rank and then drag(or copy-paste) this formula to all the cells

INDEX MATCH with Two Criteria - Error w/ Cell Autofill

I am working on a hiring trends report and have an Excel table with multiple entries per ID/individual (as several individuals have left and been rehired over years). The table looks something like this:
WORKSHEET: SHEET1
A B C D
ID Name Location Hire Date
1122 Karen Chicago 01/01/2018
1038 Tom Chicago 05/22/2016
2845 Angel Pittsburgh 11/15/2016
1122 Karen New York 10/08/2013
4992 Mallory Seattle 09/14/2015
2845 Angel Pittsburgh 07/21/2011
1122 Karen Pittsburgh 08/22/2011
I have created a new table with only one entry per person and their most recent hire date. The next step is to populate the table with location data based on the person's ID and specified hire date.
My approach was to use an INDEX-MATCH expression with two match statements (one for ID and one for hire date):
=INDEX('SHEET1'!$C$2:$C$2000,
MATCH('SHEET2'!A2,'SHEET1'!$A$2:$A$2000,0),
MATCH('SHEET2'!D2,'SHEET1'!$D$2:$D$2000,0))
The first row where I enter the expression retrieves the correct location data. However, when I attempt to populate the remaining rows in that column, I get a #REF! error, as illustrated below.
WORKSHEET: SHEET2
A B C D
ID Name Location Hire Date
1122 Karen Chicago 01/01/2018
1038 Tom #REF! 05/22/2016
2845 Angel #REF! 11/15/2016
4992 Mallory #REF! 09/14/2015
I've tested each INDEX-MATCH expression separately (first testing for a match only on ID and then testing for a match only on hire date). Each one works separately, and as shown above, it does work for the first row--it just will not autofill for other rows. I've also checked SHEET1 and each individual definitely has the correct matching criteria on SHEET2 for referencing.
Can anyone help with either suggesting a way to fix my expression or an alternative way to retrieve the location data based on two criteria? Thanks in advance!
The third argument to INDEX is the column number, which is why you get a #REF error. You can use LOOKUP instead:
=LOOKUP(2,1/('SHEET2'!A2='SHEET1'!$A$2:$A$2000)/('SHEET2'!D2='SHEET1'!$D$2:$D$2000),'SHEET1'!$C$2:$C$2000)
you can use this formula :
=INDEX(Sheet1!C1:C2000;MATCH(1;INDEX((Sheet1!A1:A2000=Sheet2!A1)*(Sheet1!D1:D2000=Sheet2!D1);0;1);0))
so you can use more than one criteria in secend index like this:
=INDEX((criteria1)*(criteria2)*(criteria3);)

Excel look up value in array, return next value

I would like to look up a value in a range and return the value in the next row, but can't quite figure out how to do this. I especially would like to do this with formulas rather than VBA, and preferably with built-in formulas than custom (VBA) formulas, due to macro security issues.
I'm using Excel 2010. My workbook has two worksheets, "assessment" and "lookup". In lookup, I have lookup tables.
"lookup" looks something like:
Column A Column B Column C
1 Sales Engineering Manufacturing
2 Alice Bobbie Charlie
3 Dawn Edgar Frank
4 George Holly Isabel
In "assessment," I have some some drop downs from which users select one name from each column in "lookup." Based on some other criteria, I then rank these and create a new, sorted list (using INDEX() and MATCH()) that produce the selected name and corresponding column name a new sort order
Column A Column B
10 Engineering Edgar
11 Sales Alice
What I'd like is to return the name from the next row.
Column C
10 Holly
11 Dawn
But I'm having real trouble figuring out how to get there.
Assuming lookups is located at B2:D5 (change as required) and the result data is at F2:H3 (change as required) enter this formula in cell H2 then copy down.
=INDEX(
INDEX($B$2:$D$5,0,MATCH($F2,$B$2:$D$2,0)),
1+MATCH($G2,
INDEX($B$2:$D$5,0,MATCH($F2,$B$2:$D$2,0)),0))

Find repeat names in column B based on date criteria in column A

I have two columns of data in Excel. Column A is an interaction date, and column B is a name. I'm looking to devise a way to identify repeat contacts by the same name that occur within 1 day of each other. eg:
Date Name
2016/01/01 John Wayne
2016/01/01 Paul Friesen
2016/01/01 John Wayne
2016/01/01 Alex Roschenko
2016/01/02 Paul Friesen
2016/01/02 Peter Mansbridge
2016/01/02 Jake Snake
2016/01/03 Paul Feig
2016/01/03 John Wayne
Using only this sample data, the result I would be looking for is 2 (John Wayne and Paul Friesen both repeated in =< 1 day.
I'm not sure if Excel or Access are the better tool to use for this, but I'm more experience in Excel, I just haven't been able to come up with a formula...
Use a helper column.
In a blank column put the following in row 2:
=SUM(COUNTIFS(B:B,B2,A:A,A2+{-1,0,1}))>1
This will return a column of TRUE/FALSE
Then referencing the helper column we use the following array formula:
=SUM(IF($C$2:$C$10,1/COUNTIFS($B$2:$B$10,$B$2:$B$10,$C$2:$C$10,TRUE)))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done properly then Excel will put {} around the formula.
This formula counts the unique names that have TRUE in the helper column. So no matter how many times the name has TRUE next to it, it will only be counted once.

Excel Index Partial match

I have Sheet1 with column A listing every single country in alphabetical order..
A
1 Afghanistan<
2 Albania
3 Algeria
4 American Samoa
5 Andorra
----------
228 United Kingdom
229 United States
etc
I have Sheet2 column A with empty cells with adjacent cells in column B listing address details
A B
1 empty cell Unit 3, Road;London, United Kingdom
2 empty cell Building 1, Road, TX, United States
3 empty cell 8th floor, Business Park, India 1234
etc
What I would like to know is how can I obtain the country within the address details in sheet2 column B and place them in Sheet2 column A, based on a match on the list of countries in Sheet1 column A.
Part of the problem is there is no coherent method as to how to country is placed within the address; could be at the end or in the middle of the address.
I have tried various index match formulas with no luck
any help would be appreciated.
I tried it with the reference table being in A1:B7, and lookups being A10:B10 onwards down. The formula is for these cells. You can adjust it for Sheet1/2!.
Assuming your data is in B10 onwards, and your reference data was in B1:B7, you can write this formula in A10 =INDEX($B$1:$B$7,MAX(IF(ISERROR(FIND($B$1:$B$7,B10)),-1,1)*(ROW($B$1:$B$7)-ROW($B$1)+1))). This is an array formula, so please hit Ctrl+Shift+Enter for excel to read it as an array formula.
(In the screenshot, I have pasted the table in A10:B12 as values only in D10:E12)
Text to Columns with a comma delimiter

Resources