VLOOKUP for matching employee id - excel

I have 2 spreadsheets I am working with. They both contain tons of data and numerous columns. Spreadhseet1 contains columns ssn_id and employee_id. Spreadsheet2 contains column ssn_id and does not have employee_id. I want to use VLOOKUP to create another column that provides the employee_id of the employee based on their ssn_id.
I used the code below:
=VLOOKUP(L3,[spreadsheet1.xlsx]spreadsheetname!$A$2:$Q$99999, 3, FALSE)
L3 is the column in spreadhseet2 that contains the ssn_id, I used that as the lookup value because I am using it to get the employee_id. In spreadsheet1, The column Q contains the ssn_id, hence why I set the range from A to Q. In spreadsheet1, the 3rd column (column C) contains the employee_id, which is why I set the column index number to 3. This is how i feel like it should be written, but it keeps on providing me #N/A values. Can anyone let me know what I am doing wrong?

Related

Excel - Finding Data in one Column and showing the values in the corresponding column

I'm having a lot of trouble trying to come up with the right formula for this...
I hope it'll be clear!
I have 2 sheets in my Excel.
The first has Active IDs (~500 rows).
The Second has All IDs, active & inactive with a dollar value associated to each member (~1200 rows)
What I want is for Excel to take the ID in the First Sheet with all the Active ID, find it in the 2nd sheet and return the $value.
So that when I look at Sheet 1, I see the Unique ID associated with their respective $value.
Thanks!
This can be done with a lookup function, for example Vlookup.
If your IDs are in column A, you can use
=vlookup(A1,'Sheet 2'!$A:$B,2,false)
In Words: Find the value in A1 on Sheet 2 in column A and return what is in column B (the 2nd column).
Copy down.
You also can use INDEX MATCH combination (more efficient than Vlookup)
= INDEX( Column_with_values , MATCH ( cell_with_Active_ID , Column_with_All_IDs )

Index and Match with mulitple sheets and parameters

At work we have a large collection of sheet that I'm trying to add a couple columns to.
Some of the Index functions were already in the sheets so I am trying to base my new index function off of it because I have never used these types of functions in Excel. The old function is as follows.
=INDEX('Order Detail'!$D:$D,MATCH($A9,'Order Detail'!$B:$B,0))
Order detail is the name of the sheet that is holding the date for the output.
A9 is the part number in the current sheet.
And the part numbers are listed in column B or the order detail sheet.
What I know want to do is match the part numbers for the two sheets and match the dept number. The dept number is located in column L of the order detail sheet and I want that to match 1000-1. Not 1000 minus 1 actual 1000-1.
IF both of those match I want to spit out the data from column O in the order detail sheet and output that in column U starting at U9 and down in the current sheet.
This is what I have so far for this but it does not work.
=INDEX('Job Routing'!$O:$O,MATCH($A9,'Job Routing'!$B:$B,0),MATCH('Job Routing'!$L:$L,"1000-1"),0)
I only want it to output the O column if the Part Number AND Dept Number are the same as the part number in A9 and the dept number the same as 1000-1.
Any ideas?
Thanks

Index match formula with multiple criteria without array

How do I add multiple criteria to this index match formula, which I pulled from a previous post, here: Use of INDEX MATCH to find absolute closest value.
=INDEX(B4:B10,MATCH(TRUE,INDEX(ABS(A4:A10-B1)=MIN(INDEX(ABS(A4:A10-B1),,)),,),0))
The formula above uses only one criteria while I need to use three Sample
I'm trying to use the same formula for a sample problem. I want to match cols B & D in table A to cols A & B in table B using the closest number in col C (table A) to output into table A, the corresponding col D from table B.
If you have an aversion to using Array Formulas [or if you would prefer not to for legitimate reasons, of which there are some], my recommendation is that you use a helper column to create a new unique ID.
For example, assume column A contains client Country, column B contains client State/Province, and column C contains client City. You would need all 3 to identify the geographic location of a client. So, create column D, as follows [starting in D2, and copied down]:
=A2&B2&C2
This will create a new field which shows CountryStateCity. If you want this to be displayed anywhere, you may want to add commas, as follows:
=CONCATENATE(A2,", ",B2,", ",C2)
Note that CONCATENATE is effecively the same as using '&'.
Now to search and find the client name in column E, which matches the geographic location [assuming that there's only 1 per city, but this is just an example anyway], do as follows:
=INDEX(E:E,MATCH("USA, Michigan, Detroit",D:D,0))

Fill out a column based on 2 other colums

I am trying to build a macro that will allow me to automatically fill out the cells in a column based on 2 criteria, which are the county and the project type, both of which are their own column names. The column to be filled out will be called "Frequency Band", which will have a static range of 12 possible values.
For example, if the County is "Bergen" and the Project Type is "2", then the Frequency Band will be "800Mhz". If it is the same county (Bergen) but the project type is "3", then the frequency band will be "1900MHz".
I currently have the list of Frequency Bands listed in another worksheet (Just call it sheet 2, cells E2 – E13), so I imagine that the outline of the VBA code would look something like:
If County(A) = Lee AND Project Type(B) = 2 Then Frequency Band(C) = 800Mhz(E3)
Else if Project Type = 3 Then Frequency Band = 1900MHz
Etc., Etc. for each county
Since I’ve never coded in VBA before and have no idea of its syntax, I don't really know where to begin with a formula like this. Could anyone help get me started?
Here is one way it would work with a formula.
In cells G1:K6 there is a table with your stored data (could also be on another sheet)
Column A you put in a country, column B you put in a project type (would be good if you validated against your source data.
Column C is your lookup function
'=INDEX($H$2:$K$6,MATCH(A2,$G$2:$G$6,0),MATCH(B2,$H$1:$K$1,0))
Index takes 3 main inputs:
the array (H2:K6) which is the actual frequency values
a row number in this array, and a column number in the array
For the row number lookup your country in the list you have (g2:g6) and it will tell you it is the x number in the array which corresponds to the row in the index array
Same thing with the column and project type.
There is a ton of information on the net about index and match if you need more information.
Highlighing is to show which values the formula has picked in my three examples below.

Filtering Dataset by values in one column

So I have an excel dataset of participants that are possibly eligible to partake in a study that consists of their names, age, telephone number, etc... like:
Name | Age | Phone | Email | Address | Studies Participated in
I also have a column of names of participants that are eligible for a new study; it is a subset of the data in the name column.
What I need to do is select all of the participants whose names are in the subset column, and copy and paste all of their information in all of the columns into new columns.
I have tried something like, selecting an empty column and using =IF($Name-column = $Subset-column, First-Column:Last-Column, "") But this only checks if the name in each cell of the Name Column matches the name in the Subset column. What I need is something that checks if any of the names in the Name column match those in the Subset Column, and if they do, then to copy that row to a new worksheet.
Using a VLOOKUP should do the trick.
In an empty column next to the name table, you would want to enter a set of formulas something like:
=IFERROR(VLOOKUP(<name_from_current_row_of_name_table>,<subset_column_range>,1,FALSE),0)
Then you can apply a filter to the name table and set a condition to exclude the 0's in the new column. Copy the filtered data to the new sheet.
You can Index all of your data and then Match rows to the subset names and pull over each column.
For example, it would look something like this:
=INDEX(All!A1:F4,MATCH(Subset!A2,All!A1:A4,0),2)
Let's break this down:
The index function takes the following arguments:
Index(Array, Row_Number, Column_Number)
The array will be all the data you have, the row number we'll use a match function (below) to find which row to get data from, and the column number represents which column from the index to pull information from (we'll keep incrementing this to get all the columns).
To return the correct row, we'll use match
Match(Lookup_Value, Lookup_Array, Match_Type)
For lookup value, we want to point it to the current row of the subset list, the lookup array will be all the names available from the index we defined previously in the master list, and the match type will equal 0 (for exact match)
Take a look at this excel document

Resources