This question already has an answer here:
Lookup a value that matches a key in one column then apply that as a key to return a value from a third column
(1 answer)
Closed 4 years ago.
I am working on creating a database of information based on 2 spreadsheet. What is in common about them is that they have the names of people. However, not everyone has data/information for all the other columns. Is there a way to write a formula or code it so that I can get information to populate in a third sheet to say if the names are the same put this information here? I've put an example below. sheet 1 is name and location, sheet two is name is number, and sheet three is what I would like it to look like as an end product.
picture of what im going for
As the comment above mentions, you can use VLOOKUP (or INDEX/MATCH) for this. I would also wrap the entire statment in an IF and ISERROR so if there isn't a match it will return a empty string.
Something like this:
IF(ISERROR(VLOOKUP(G4,$D$2:$E$3,2,FALSE)),"",VLOOKUP(G4,$D$2:$E$3,2,FALSE))
Assume col A:B is your location table, D:E is your Number table, and G:I is the combined table where you put your VLOOKUPs
See this image for example
Related
This question already has answers here:
How to make a kind of pivot with strings?
(2 answers)
Closed 1 year ago.
I have data in the format shown in the first image with thousands of rows and different attributes. I would like for the data to be changed to a format in the 2nd image which would be easier to use and analyze. Are there any useful functions that could help me achieve this?
I would recommend you to do the following (it is not easy as applying some function, but it works haha). My Excel is in Portuguese, but I hope the images help you.
Copy the first column to another worksheet
Delete duplicates
Insert a new line before the first line on the new worksheet
Copy the second column of the original worksheet and paste it transposed - right click, transposed. Remember to just copy once each value. For example, in your case, just copy Name, Age, Height and Weight.
Finally, it is possible to add a line to represent header for your original data. For example, the first column you can call ID, the second you call Attribute and the third, Value. Then, you filter the colum Attribute by the first possibility - Name, in your case - and copy the column Value to the respective column on new worksheet. Then you filter by Attribute = Age and do the same. Do the same for all possibilities.
So, on the last step, the number of copy-paste is exactly the number of different values you have for your second column.
It is possible to do a VBA code to automate it, if you are going to do it frequently.
#1. You can try to use distinct Formula to get your data index (column A)
or Use Remove Duplicate icon at Excel Ribbon.
A2:A10 is the source list.
B1 is the cell above the first cell of the distinct list.
#2. Create Uniq Row (see my screencapture).
#3. You can use vlookup formula to match your data from sheet1 to sheet2.
So I'm going to eventually have 3 sheets. Sheet 1 is where I have data (numbers for a category and a name associated with it. Sheet 2 is where I pull the top 5 users for each category. Sheet 3 is where I have a leaderboard for points gained.
Right now I'm trying to work with Sheet 2 (grab the top 5 performers from each category. I'm fairly new to Excel, but after some research it seemed that XLOOKUP would be the way to go. (i'll attach screenshots below.
I'm using this formula:
=XLOOKUP(LARGE('Cases Test for Categories'!$C$18:$C$55,1),'Cases Test for Categories'!$C$18:$C$55,'Cases Test for Categories'!$A$18:$A$55)
however when using it I get all 0's.
Here's a screenshot of values I'm trying to grab from "Warranty Service Request"
and here is a screenshot when applying my formula
The solution I would want is to grab the 5 largest numbers from sheet 1 with the person name as well.
I don't think that XLOOKUP can get you anywhere near what you want but the formula below will get you one step closer.
=INDEX(List,MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0),1)
In fact, it's the explanation of that formula which will be of help. Here we go.
List is a named range, perhaps equal to your 'Cases Test for Categories'!$C$18:$C$55. The reason for using a name is obvious. It's shorter. In my test List = A2:B6, in case you want to reconstruct it. Column 1 has names, column 2 numbers.
The term INDEX(List,,2) specifies the second column of List. You can replace the '2' with a formula to specify different columns of the named range.
In fact, INDEX(List,,1) does specify the first column and INDEX(List,4,1) specifies the 4th cell in that column, and that is exactly what you see in my formula. All of MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0) just serves to find the row number in List, in this example the number 4.
Of course, LARGE(INDEX(List, ,2),1) returns the largest number in column2 of List. The '1' can be replaced by a formula, for example ROW()-1 which would return 1 if placed in row 2 and count up from there as it's copied down. Try =ROW()-1 in any cell in row 2 and copy the formula down.
MATCH([LARGEST],INDEX(List,,2),0) returns the row number where the largest was found, and that is the number we need to return the name from the first column of List.
This will work perfectly for one column and can easily be modified to work for different columns. Your question doesn't specify how you would like to arrange the 5 results from each category but the formula can be modified a little to accommodate whatever you want. What it can not do is to deal with ties. MATCH(LARGE can only find the first of several identical results.
To break ties in this sort of operation is complicated and must be done ether by helper columns in the data table or using VBA. It's definitely the topic of another question. For now I hope that it's a problem you will not have to anticipate.
So I currently I have a Excel sheet and what I want it to do, is lookup data that is provided on another sheet and autofill it in regards to it. I'll try to explain what I mean below.
So for example columns 1, 2 and 3 would be empty, after a code 1 is typed into column 123 I'd want columns 1, 2 and 3 to update to the values provided. It would link up to another sheet shown below and I'd like it to expand dynamically so as if more data were to be added to the below sheet it would still update.
I apologise if this sounds confusing but I've tried looking everywhere for functions that will be able to help me out. The only solution I've gotten is a VERY long nested if statement which I'm certain is the worst way to approach this.
first table is called "Autofill"
the second table is "Details"
the worksheet to be filled is called "Sheet1"
the one containing the details is called "Details"
I managed to solve it simply using vlookup on the other sheet and matching the rows
This question already has answers here:
Comparing two columns, and returning a specific adjacent cell in Excel
(4 answers)
Closed 4 years ago.
I have two small tables: one of values that the stock market returned, and the other of the values my trades returned (All of the data is made up).
As you can see, there was not a trade on every day. I am trying to create a table like the third one seen that matches the date in column F to the date in column C and returns the corresponding return. Basically I want to return the second table into the third.
I have tried to use the FIND, CELL, INDEX, etc., but as I am pretty new to Excel, I am not sure I am using them quite right.
in cell H3 of your example, enter formula:
=VLOOKUP(F3,$C$3:$D$11,2,FALSE)
...and the copy or "fill" that formula down to the end of your data (H7).
Note that this will return an error if the date does not exist in the target range.
You can suppress the error by instead using:
=IFERROR(VLOOKUP(F3,$C$3:$D$11,2,FALSE),"")
More Information:
Office.com : VLOOKUP Function (with video tutorial)
Office.com : IFERROR Function (Excel)
mbaExcel : Tutorial: How to Decide Which Excel Lookup Formula to Use
This question already has answers here:
Comparing two columns, and returning a specific adjacent cell in Excel
(4 answers)
Closed 8 years ago.
I have two excel spreadsheets. One is a list of our products(spreadsheet 1) with details, the other is a list of products but with empty fields (spreadsheet 2).
I want to lookup a cell (A1) in spread sheet 2 - find the corresponding value in a row in spreadsheet 1 and then get another cell on the same row and copy it over to the spreadsheet 2.
so search for a value "cars" in one spreadsheet and read off its the number plate in the other spreadsheet.
Is this possible in excel ? I have 1555 rows to lookup and read off for a range of values, i can copy both into one spreadsheet but 2 worksheets
Try VLOOKUP()
It does not matter if Your work is in two sheets of the same workbook or two separate excel files.
You use it like this:
You put this formula in the empty cells in the second file
=VLOOKUP(KEY, TABLE_RANGE, COLUMN_INDEX, 0)
KEY is in your example the cell were "car" value is in the second file
TABLE_RANGE is area containing both: KEY equivalent in original data and result You want to copy over. IMPORTANT! first column of range have to be the one that contains KEY values. Also remember to use absolute references ($A$1:$C$55 for example)
COLUMN_INDEX is number indicating column in selected range that You want to use as result
In Your example last parameter have to be 0 (it indicates if Your want exact result or not - it is useful to put 1 in there when You are looking not for exact values but ranges of values)
Than You copy over the formula for all rows You want.
Take a look at this image to visualize how it works and how formula should be used:
(source: microsofttraining.net)