Converting table into different Format in excel [duplicate] - excel

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.

Related

Excel Help: Dynamic range + Data Validation

I got a problem with some popular Excel question, dynamic ranges and data validation drop-downs and auto-populate. Lets say I got 2 sheets, and on one sheet I got drop-downs to choose from another sheet, and that is not a problem when I define cells and range using:
=OFFSET($A$19;;;COUNTA('0528 - info'!$E$2))
..but what about when I wanna add some new cells in between,so that they can be automatically recognized in which group they belong:
As you see for instance Column B has some "groups" where you can find more different "values" like in Column C, like Power Supply has MV1 and MV2... and so on. My drop-downs on the sheet 1 are called exactly like this "groups" and I did reference them manually using given function. But is it possible to populate my drop-downs automatically when I add for instance MV3 beneath MV2 in this table? Or RN7 on 14th row? Everytime I add new values I have to extend my dropdowns (what is fine..), but problem will be when I share this table to others, they gonna forget it 90%.
I hope you get my point, any suggest will be fine!
p.s. Indirect doesnt work in a way it should - It gives me all instances from the Column but not specific ones that I need.
=INDIRECT("Table4[VarEDS]")
Well this option gave me again what I already had before - all "matches" from the Column and still not ONLY matches that are for certain group. ...
If your Data Validation source is a "Table" as shown in your image then you can take advantage of "Table Column" Range which is dynamic. That means whenever you refer that column as NAMED range and if make changes to the column (Edit, Add, Delete) it will reflect in the referred cell.
You can use this technique even for ranges not in table. You need to NAME them with offset formula and make dynamic.
You can find dynamic address of your column as shown in the image below. Select entire column WITHOUT Header
Name your column data range with appropriate name as shown in image below
Then in Data Validation Window refer this name using F3 as shown in image below.
Then you can see... Even if you edit, add or delete any row in the column the data validation will change
Editing based on your comment below: If you want text from column B and Column C appear together in the validation dropdown list. Insert column in the table and join text from column B and C and then make data validation based on that column as shown in Colum D in image below
Finally I think I understood your question.
Watch this video
Excel: Find Multiple Matches & Dependent Drop Down List
After some days of searching and trying I got what I wanted - wasnt wasy job at all. Needed to combine more functions with the help of couple of videos from Leyla (Xelplus):
https://www.youtube.com/watch?v=gu4xJWAIal8
https://www.youtube.com/watch?v=7fYlWeMQ6L8&t=5s
First step was to make unique list of my values (text in my case) on separate sheet:
=IFERROR(INDEX(t_VarGroup[Vargrouptext];MATCH(0;INDEX(COUNTIF($J$2:J2;t_VarGroup[Vargrouptext]););0));"")
Then I needed to "extract" all the values that are belonging to the certain unique values:
=#IF($I3<COLUMNS($K$2:K$2);"";INDEX(t_EDS[[VarEDS]:[VarEDS]];AGGREGATE(15;3;(t_VarGroup[[Vargrouptext]:[Vargrouptext]]=$J3)/(t_VarGroup[[Vargrouptext]:[Vargrouptext]]=$J3)*(ROW(t_VarGroup[Vargrouptext])-ROW(t_VarGroup[[#Headers];[Vargrouptext]]));COLUMNS($K$2:K$2))))
FUrthermore, I created Unique drop down list:
=OFFSET($J$3;;;COUNTIF($J$3:$J$14;"?*"))
And then dependent drop down list nearby using:
=OFFSET($K$2;MATCH($H$2;$J$3:$J$17;0);;1;COUNTIF(OFFSET($K$2;MATCH($H$2;$J$3:$J$17;0);;1;20);"?*"))
And because I made it on other sheet, I had to reference them to an appropriate sheet name where my main sheet is - with drop downs, it is actually very useful for my future work and for everyone else who has struggling with drop downs but on a bit specific way =))
credits to: #Naresh Bhople for suggestion about Youtube videos.

Extract all rows from excel data set when multiple cells contains certain text

This question was asked and the answer ALMOST works for me.
THE PROBLEM
Very simply from the above dataset I wish to recreate this range but filter for only select BLOOD TYPE O.
The answer given is:
=IFERROR(INDEX(A:A,SMALL(IF(ISNUMBER(SEARCH("O",INDIRECT("$A2:$A"&COUNTA(A:A)))),ROW(INDIRECT("$A2:$A"&COUNTA(A:A))),""),ROW()-1)),"")
This works only in ROW 2. I have tried everything to get this to begin in a new row and column (I also want the data to be in a different row and column) but whenever i update the formula, nothing is returned.
ED please see this new picture:
In the image above, I place your example data set in the range C3:F13. Based on your question it sounded like you were trying to filter your list based on blood type, but I was not sure if you just wanted names, or some other combination of columns. This solution assumes you want all columns in the order they are presented. I placed the following formula in I5:
=IFERROR(INDEX($D$4:$F$13,AGGREGATE(15,6,(ROW($C$4:$C$13)-3)/($C$4:$C$13=$I$2),ROW(A1)),COLUMN(A1)),"")
In I2 is the value of the blood type you are filtering your list for.
in the formula above, adjust the ranges to suit your data range locations. The -3 in the formula is for the number of header rows before the data starts. If you have headers or other space and your first piece of data was in row 15 then you would need to change -3 to -14.

Can I pull correct values for a variable from an old spreadsheet into a new one that's missing those values?

I have an excel spreadsheet with several columns, each representing different variables collected from various patients (rows). One of the columns is the unique medical record #, another is a unique visit identification #. The problematic one is "age." I must have inadvertently dragged and replaced the ages of about half of my subjects, since I doubt that >3000 of my 6000 patients are 54 years old.
I have the original file with correct ID# and age pairs, but I've done considerable work on this file and cannot start over. Is there a way in my new file to look at the ID# in column C, go to the old excel file, find that ID#, go over 3 cells to column F (age), copy that age value, go back to the new excel file and paste the correct age for each ID#?
I cannot simply sort both files by ID# and copy/paste all of the ages as a number of the cases have been intentionally removed and so the ID#s wouldn't match up because the total N is different.
I also have SPSS and R available to me, although I'm not particularly proficient with either.
Just, as an example, here's what the two spreadsheets look like:
http://imgur.com/OjZsLEJ
I've manually highlighted the bad values, but in reality there are 3000+ of them and manually checking would be very time consuming.
Thanks in advance!
A VLOOKUP function should work here:
=VLOOKUP(C3,[OldWorkBook.xlsx]Sheet1!$C:$F,3,FALSE)
If you place this function in Column C, Row 3 of the New Workbook and then change "OldWorkBook.xlsx" in the function to reflect the name of your old Workbook, it should return the correct value from your old Workbook.
You can then copy that formula and paste it into the remaining cells in that column.
If the values are correct, you can copy them, Right-Click and select "paste values" to solidify them in your new workbook.
If I've understood your question, that should fix the problem. If not, please let me know.
You can do that with a VLOOKUP formula.
It should look like this (check if the cell references are right, and also the file and sheet name).
You should put this in a new column in your "NewFile".
The formula references the "OldFile" and should bring the value for the "F" column in the "OldFile" whenever the values for the "C" column are the same.
This example would be for the second row of the file (I am assuming the first row are column headers).
=VLOOKUP(C2,'[OldFile.xls]Sheet1'!$C$2:$F$6000,4,FALSE)

Excel look up and copy over [duplicate]

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)

Lookup values in an unknown range - Excel

Is there any way to look up and display the latest value in a group that does not have a set range?
Here's a breakdown of a question. I am working with some data that I like to break into data groups that can be collapsed. On a weekly basis I un-collapse the group and insert a line at the bottom with the new information. I would like that latest bit of information to be automatically displayed on the top cells that is displayed when collapsed.
I have used look-up tables and I have a function that I used for testing purposes: =LOOKUP(2,1/(C5:C11<>""),C5:C11) that obtains the last cell within that designated ranged: C5-C11.
Now can I do something similar within grouped data values that have no defined range?
One way to do this is with an index function, assuming that there are no other rows of data on this worksheet other than the group that you're trying to find. Here's an example of a formula that could work for you. It assumes that your data starts in K2 and you want to have your result in K1.
=INDEX(OFFSET(K2,,,ROWS(K:K)-ROW(K2),1),MATCH(9.99999999999999E+307,
OFFSET(K2,,,ROWS(K:K)-ROW(K2),1)),1)
The offset creates an array for all cells below k1 without counting k1. The match function searches for the largest number possible, this formula assumes that you're looking for numbers. If you're looking for text, or a combination, you'll have to use a different formula by replacing the match portion with:
MATCH(REPT("z",255) 'for text
MAX(MATCH(9.99999999999999E+307,range),MATCH(REPT("z",255) 'for numbers and text
Source: http://www.techonthenet.com/excel/questions/last_value.php

Resources