I get seven workbooks (xlsx files) from different clients, each with one sheet.
Each sheet has at least one common ID column (UNIQ, PK). One of the workbook contains list of all possible ids. Others may not have record for all ids, but each row has id value defined.
I need to make a final workbook, with first column ID and then union of all remaining columns from each file.
Then I need to send the final.xlsx via email, so its independent of the source files (I'm not sure if its possible to dereference it while retaining the constant values).
Can we do this using VLOOKUP or built-in Excel functions?
If you are going to perform this operation only once. You can do it like this:
Go to the workbook which contains all the IDs(Workbook0)
Apply vlookup in Workbook0 to fetch all the values you need from workbook1
Repeat the process to fetch values from workbook2...3..& so on
Eventually you should have a workbook (workbook0) which will have all the data you want, with ID in first column & rest of the data in further columns
Now to de-reference it, select all the cells which contain formula & press Ctrl+C
Without deselecting, go to Paste -> Paste Special & select Paste Values. This will overwrite the formula cells with only values
Then go to Data -> Connections
Break any connections with other workbooks (if exists)
Save & you are ready to email an independent file
Also, if this is something you have to do very frequently & the steps remain same. I'd suggest that before starting, you click on Record Macro, then perform above steps, tweak that code a little, save it in some other file for future & from next time you won't have to do it manually.
In case you would like to try different approach, take a look at the "Excel Query Wizard" https://superuser.com/questions/722348/merge-and-combine-in-excel/747430#747430
Import the two excel files into Access database.
Use Query wizard to select from the two tables and copy the result to a new excel sheet.
Access and Excel are in the same package so no extra cost.
Related
I have an Excel workbook that has ~100 sheets in it, and each sheet is a table whose headers are exactly the same. I have edited the text of the headers in my blank "to copy" sheet, but I now need to copy those changes across each and every existing sheet (the rest of which have data in them that I cannot lose/change).
I have already tried using Shift+click to select all the sheets, but cannot edit the header because they are already formatted as tables and I get the "Cannot make changes to a table or XML mapping when multiple sheets are selected." error. So I either need a way to select every sheet and make them not a table anymore (temporarily) so that I can make the bulk change, or find some other way of doing this change while they are still a table.
Thanks for your time and advice.
Mirror a single table to multiple sheets in excel using vba
You might see this solution, As it is not possible to change multiple sheets while they are formatted as tables .. you might do the changes if your sheets are not formatted as sml or tables.
I'm looking for help with a formula if possible.
I have a sheet within a workbook called 'RAW' and in column 'I' it has a series of agent names. What i want to do is copy these names into the sheet named 'YTD' into column B but in the process of this also remove any duplicates that appear in the new unique list.
The formula i was working with is below however i when i try to amend it to what i need i get circular reference errors. Any help appreciated.
=INDEX(Raw!$I3:$I10000,MATCH(0,INDEX(COUNTIF(Raw!I:I,Raw!i:Raw!i),0,0),0))
For tasks like this, I recommend you use the available manual tools already present in excel. Simply copy and paste the column as you would, and then in your new list, go to the Data Ribbon > Remove Duplicates.
Automation should be used when you have consistently repeating tasks with exactly the same form of input and output. For all of the random things you need to do in excel, relying on automation developed elsewhere can greatly reduce your actual speed at performing these tasks.
I am trying to write and excel macro that will copy data from an excel file with multiple sheets. Each column will have different lengths and the name of the sheet will not always be known. I want it to start by having the user select the original file and a new one be started, which is where it will be copying to. There are multiple columns and only two of them I am interested in. They are the m/z and the intensity. I also have to know which sheet the value came from. I would prefer it if they sheet name was presented in a column next to the combined m/z's and intensity's. I am new to this and can use all the help available.
As above - use the macro recorder and make sure you are using named ranges.... an example upload would also help p[eople help you...
Currently: I have a few sheets that contain one or more tables (e.g., Sheet1 has one table while Sheet2 has three tables). These same sheets are found in several end user workbooks. The tables in those sheets are used by structured references within cell formulas in the workbook.
Goal: I would like to have another workbook (a master workbook) that only has the sheets that contain the tables. Updates would be manually made to the master workbook i.e., add a row, delete a row, edit a row, add a column, delete a column, edit a column. Once updates are completed with the master workbook, the updated [master] sheets would then be placed into the various user workbooks, replacing the existing sheets and thus the tables (using VBA)...without breaking the structured references! No #REF errors! Well, this is what I'm envisioning, however, it doesn't have to be exactly this. Also, the common table sheets must be in the end user workbook, no external referencing! Unless it's part of the process to make what I need work, of course :-)
I'm very handy with VBA but not a MVP. Assume all of the workbooks -- both end user and master -- exist in the same directory. The master workbook would contain the code that would deliver the updated sheets to the end user workbooks. Excel 2007 & 2010 in Windows 7 environment.
I don't have any code as I'm trying to manually figure it out first without breaking anything. Suggestions welcomed! Thank you.
[Update 13Jun2012] Hopefully this more long-winded explaination will help.
What I'm doing:
I have a workbook that (essentially) copies itself into an end user workbook (1 to n times based on user form inputs). The end user workbook is protected to keep end users from making mistakes in certain formulas (various forms of sheet/cell protection). There are some sheets that contain tables and these tables are the same for all users. These tables are used for data validation (e.g., Allow: List; Source: =timing_droplist) and VLOOKUPs (e.g., =VLOOKUP($W8,Timing_table,FE$5+1,FALSE)). These end user workbooks are created once a year but updated three times during the year (they're for finance/budgeting). The tables can be updated at any time. Since data is added to the end user workbooks it's not convienent to re-generate those workbooks with the updated tables and then have the end user re-enter all their data. So it would better if the existing end user workbooks could have the common tables updated all together (using VBA).
What's happening (just ONE example):
"Timing" sheet exists and contains the table "Timing_table". If the master "Timing" sheet is added to the workbook, Excel renames it to "Timing (2)". This is normal. But the table in the added sheet becomes local instead of globle AND it, too, gets renamed, FOR EXAMPLE, "Timing_table12". I don't know how Excel comes up with the digits for the table name and they could change. If I delete the old "Timing" sheet all references to it are broken (of course) -- pulling up Name Manager shows #REF! in the value column. Renaming the new references doesn't fix the issue because the new references are local to the new sheet.
I tried manually cutting and pasting a table into another, pasting as Text, and that doesn't keep formulas (basically it performs a Paste as Values operation) and, overall, doesn't work. Just looking for options. External references to these tables is not an option.
I think that this thread might help you out: http://www.ozgrid.com/forum/showthread.php?t=66791
To provide you the reply directly (assuming that the problem mainly involves the external referencing):
Replied by Aaron Blood:
Re: Copy Formula To New Worksheet Without Path
You've already developed the code to do the copy/pasting to a new sheet and workbook. Now all you need to do is scan the formulas of the new worksheet and remove the ext refs from the formulas.
Run something like this at the end of your existing copy/paste macro...
VB:
Sub ExtRef_Remover()
Dim cell As Range, n As Variant
For Each cell In Workbooks("New_WB").Sheets("Sheet1").Cells.SpecialCells(xlFormulas)
n = Application.Find("]", cell.Formula)
If Not IsError(n) Then
cell.Formula = "='" & Right(cell.Formula, Len(cell.Formula) - n)
End If
Next cell
End Sub
Using extensive external references just didn't work out in this project so I convinced the project manager that we needed to change course. She agreed that what she wanted was too much to ask and taking too much time to implement, aside from compromising workbook generation and stability. I ended up using a data pull into the necessary tables via a command button. Waaaay easier to work with and stable.
In short, I would either:
Create a macro that runs every time a cell within a certain range is changed, and then writing out the result based on those cells.
-OR-
Create a macro to automatically insert functions that would do the same thing
Things to consider are that this would need to work on multiple tables of varying length without need to manually change anything, and that the results of individual sheets would need to be also displayed in summary on another page.
Which would be more desirable/more efficient/easier to implement?
The subject data entails testing procedures. Sheets contain testing criteria and a column containing PASS/FAIL results. I need to tabulate these. The start of the table and the end of the table are at different rows and are subject to changing.
Without seeing your actual problem I would definitely go for the first option. Having many formulas inserted into cells dynamically I think would be a pain.
Use the Worksheet_Change event and test whether the cell changed is one of your target range, then perform whichever action is required.