I have say 100 output Excel files with column A full of variable names and column B with values. I have put them into separated sheets of one file. and I would like to get an overview sheet.
The thing is that the same variable is not in the same place (same column but different rows). I need to first identify the correct row number and then get the value.
My question is with the name of the variable and the sheet name available, how can I build a code to get the value?
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.
What I am trying to do is to show only a part of a column into another sheet through a formula.
Basically I have an Excel file in which I type in work shifts, as you can see on the example. The top of this table contains the date. The first column contains the name of the employee.
If possible I'd like to have the column of a specified date on another sheet (maintaining formatting), so that I can “sort” employees in their exact place without the need of swapping between Sheets.
The “blacked out” part is the one with employees names, the red-highlighted part is the one that should “appear” on the other sheet.
I have two excel spreadsheets (that I can put onto two separate sheets within one sheet, one call A, and one called B).
Spreadsheet A/Or Sheet A
NAME,SPORT
Jordan,Tennis
Jordan,Basketball
Jess,Tennis
Mike,Baseball
Spreadsheet B/Or Sheet B
NAME,AGE
Jorden,5
Jess, 6
Mike, 10
I want to make it so that I can merge the two spreadsheets such that the "Age" column is added to Sheet A with the resulting spreadsheet:
NAME,SPORT,AGE
Jordan,Tennis,5
Jordan,Basketball,5
Jess,Tennis,6
Mike,Baseball,10
How can I do this?
Assume there is an exact match for names in Spreadsheet B to Spreadsheet A (first names only, no need to worry about last names).
Range of values could be variable, but if it's just a matter of making sure the range is updated as new values are put in manually, it's okay. Unless there is a smarter way.
In sheet A, cell C2 :
=INDEX('Sheet B'!$B$2:$B$4,MATCH('Sheet A'!A2,'Sheet B'!$A$2:$A$4,0))
Things to consider :
Is the size of your data variable ? > Do you need to adapt the look up range ?
Will you have duplicates in the names ? > What if two different kids are called "Jordan"
I have two workbooks, a source file and an output file.
The source file contains information which occupies some drop-down lists in the output file.
For each drop-down list I have two 'names' (in the name manager) linked to it. For instance, the name 'SchemeID' in my output file refers to the same name in my source file. It consists of several rows/columns of data, and that populates my drop-down list.
There are some repeats in the source file (e.g. different names associated with the same number) which are appearing in the drop down lists, and I'd like to get rid of them so the list only displays unique values. Is it possible to do this using data from different workbooks?
The easiest way is oging to be to go to the source workbooks, Data Ribbon -> Remove Duplicates. Anything else will require a couple of in-between data sheets or VBA to do cleanly. If your data doesn't change option this manual method should be fine.
EDIT as you seem restricted from editing the Source File
In a different sheet (let's say Sheet2) you will need a formula which pulls in all of your data from your 2 source Names. To my knowledge there is no clean non-VBA way to combine to Named Ranges, so we will need to do this by dumping the data down to a sheet, and then picking it up again.
There are a lot of ways to do this, but I'm going to pick the one broken down to the most steps; it will be a pretty messy sheet, but you can hide it if you need to, which shouldn't be a huge concern as a non-VBA method will need a data dump sheet anyway.
In Cell D1, we will put the number of rows in SchemeID, as follows:
=ROWS(SchemeID)
In Cell D2, we will put the number of rows in SchemeID2 (which I assume is the name for your second list, which you didn't specify):
=ROWS(SchemeID2)
In column B we will be dumping in the data from both named lists, without sorting or eliminating duplicates. Do this as follows, starting at A1 and dragged down (if you want headers this gets a little trickier, so I will assume no headers).
=IF(ROW()<=$D$1,INDEX(SchemeID,ROW()),INDEX(SchemeID2,ROW()-$D$1)
This says - if the row is not more than the total entries in SchemeID, then pull the value from SchemeID at the current row #. Otherwise, pull the entry from SchemeID2, at the current row# less the total rows in SchemeID (so if we are at row 10, but SchemeID ends at row 4, then row 10 will pull the 6th entry from SchemeID2).
Now in Column A, we will be checking to see which row is a duplicate, as follows starting at A2 [A1 is hardcoded as 1]:
=IF(ISERROR(MATCH(B2,$B$1:B1,0)),A1+1,A1)
This checks to see if there's a duplicate of the current value in column B, in the rows above the current row. If there is, it keeps the same index # as the row above (which will be ignored when we use this as the index key next). If there's no duplicate, it adds 1 to the index number.
In cell D3, put the following formula to track how many unique IDs there are:
=MAX(A:A)
Next, in column C, put your new list, which pulls from column B for as many unique values as there are [drag down]:
=VLOOKUP(ROW(),A:B,0)
This is your new non-duplicate list. To make a clean reference to it, create a new named range with the following formula:
=INDIRECT("'Sheet2!R1C3:R"&'Sheet2!$D$3&"C3", FALSE)
This will simplify to [Assuming 20 rows of data in column C, bsaed on what D3 says]:
='Sheet2!R1C3:R20C3'
Which, in the R1C1 method of referencing, means Sheet2!C1:C20.
This new named range should be what your dropdown lists refer to on your other tab.
I have two excel files, one that I pulled from excel and the other that I pulled from SAP. One file, the larger one, has a column named EmployeeID and the other has a column named EMP_ID, the only difference is the name, the actual employee id within these columns is the same. What I am wanting to do it combine these two files to make a single file; however, for example, Employee ID 'ZZZ' on the first excel file may be on line 1, but on the other file the EMP_ID of 'ZZZ' may be on line 35.
Is there a way to somehow combine these 2 files? Also, sorting by EMP_ID A to Z won't help, because the files don't have the exact same number of entries, so that wouldn't sync them so that each employee is on the same line on each file.
These two files are for reference if it matters. File 1 - http://i.imgur.com/go1S6Ra.png File 2 - http://i.imgur.com/x4vOKIN.png
Here's a pure excel solution. Open file 1 one and go to an empty sheet. Copy and paste the content of file 2.
Go to the first cell in a blank column on sheet two and use vlookup. The formula will look something like this, but you'll have to modify it.
=VLOOKUP(A1,Sheet1.$A$1:$B$419,2,FALSE)
There are four arguments and you will need to play with the first three to get what you want.
A1 Change this to the cell where the employee ID lives in sheet two. So if it's in the third column, this should be C1
Sheet1.$A$1:$B$250 This is where the data from file 1 is. The default name for the first tab is Sheet1 but it might be something different depending on how you opened the file. The second part is the data range. Top left cell and bottom right cell. So if you have 5 columns in sheet one and 1000 rows it will be $A$1:$E$1000 (I'll explain the dollar signs at the end)
1 The third argument how many columns the target data is to the right of the employee ID. So if your columns are ID, First Name, Last Name, putting 3 here would get you the last name.
FALSE, this controls excel's matching behaviour. TRUE looks for close matches, but really it just makes thing unpredictable.
Once the search is working and you're looking up what you want, fill the formula in for the rest of the column. You will get an error if the ID you're trying to lookup isn't in Sheet1, so make sure you tweak the formula on one that exists. If you need to look up multiple things (e.g. First Name and Last Name), just drag the formula to the right and put in a different number for the third argument.
So what's the deal with the dollar signs? This affects what happens when you drag the formula down or over into new cells. If you write this:
=VLOOKUP(A1,Sheet1.A1:B100,2,FALSE)
and drag it down one cell you'll get this:
=VLOOKUP(A2,Sheet1.A2:B101,2,FALSE)
All the row coordinates go up by one. If you dragged it over instead, all of the column coordinates would go up by one, like this:
=VLOOKUP(B1,Sheet1.B1:C100,2,FALSE)
Dollar signs freeze them in place, so the range doesn't drift. You want the search value to keep moving because every line should be looking up the next employee ID, but you don't want the range to move.