How to link worksheets in excel to allow inserting new rows - excel

I have a master sheet which is made up of data from 5 sub sheets. The data is updated in the sub sheets and then linked to the master sheet.
I want to be able to add new data (rows) to the sub sheets and have the master sheet update automatically. I used the INDIRECT function, but it requires me to estimate the max number of rows and then copy the function that far. This leaves my master sheet with large white spaces where the link switches between sub sheets. Ideally I would like to be able to have the master sheet be continuous with no white space in the middle of the data.
This is the function I used:
=OFFSET(INDIRECT("'Sheet1'!A2"),ROWS($A$2:A2)-1,COLUMNS($A$2:A2)-1)
Note:
My data starts in row 2 because row 1 has heading data.

little confused as to what you are trying to do exactly but
using the count function so you don't have to estimate the rows?
=OFFSET(INDIRECT("'Sheet1'!A2"),0,0,Count($:A),Count(A:A))
also what's in cell sheet1 A2 that you need indirect? is it just to point to the name reference for the subsheets? which if is the case then i assume all sub-sheets are formatted the same?
=OFFSET(INDIRECT("Sheetname"&"!A1"),0,0,count(indirect("sheetname"&"!A:A")),count(indirect("sheetname"&"!1:1")))
again i'm not exactly clear as to what you are trying to accomplish

Related

skip if statement is false in excel mac

I am currently working on a database (that's why I needed to blur some cells.) and I want to copy some data from the first sheet according to the graduation status. We are planning to use this database for next years too, so I want it to copy the data automatically when someone adds information. I wrote a formula for this, it is copying the data as I want but it cant skip the false condition; as it can be seen, the 8-9-16-17th row in General Sheet is copied to Student Sheet.
I saw another problem like mine and tried to implement the formula in my sheet but I couldn't make it work.
The problem that another person was dealing with: Get cell value but skip row if wrong
The formula I found and tried to implement in my Excel book: =IFERROR(SMALL(IF(($B$2:$B$15="Denied"),$A$2:$A$15,""),ROW()-2),"")
The formula I used in my Excel book: =IF(GENERAL!E3 = "Student";Table1[#Name];"")
With Excel 365 you can use the Filter() function. In the sreenshot I used
=FILTER(A:C,B:B="student")
Be aware, though, that with any formula solution, the result will be dynamically recalculated, so if you are planning on adding any data to the filtered table, these manual data entries will become a problem when the formula updates and the previous results occupy different positions.
If your goal is to get a one-time copy of all the non-graduated Students in Sheet A, you could just sort the sheet by the status column and copy/paste the desired data into a new sheet. That pasted data will not change and you can make manual edits.

Comparing two different Excel sheets in same workbook

I have two excel sheets. Sheet 1 has roughly 2400 rows (and will continue to grow) and sheet 2 has roughly 4400 rows (and will also continue to grow. Sheet 1 has one column and sheet 2 has 2 columns (but I only care about the first column). I need to compare sheet 1 and sheet 2 and be able to see what sheet 1 values are NOT in sheet 2. Ideally, this data would then populate a new sheet 3.
I have searched through many sites and many pages here with stackflow, but because I am so new at this, I'm not sure if I have come across what I need or not. Everything I have tried is not working.
Any help would be greatly appreciated!!
Additionally to the already mentioned vlookup or match alternatives you may copy the values from Sheet1 to a new worksheet and add a column "source" where you enter "Sheet1". The same you do with the values from sheet 2. And then you create a pivot table to see immediately which values are on which sheet:

Copy & Paste From Different Workbooks to MasterSheet

I have one workbook with 8 sheets per country (i.e. France, Belgium, etc.). Apart from these sheets I have "Mastertab" and "Database".
Country-sheets are created in the same way (they have the same template). These templates are made to track expenses (therefore for example, France may have 10 expenses, Belgium 3 and UK 81).
What I would like to do is to create a macro (because I think it is impossible with formula if I want to avoid blank rows) that will:
Find last row where is any data/value in column K.
Select all data (row that will be indicated in point 1 and columns B-P).
Paste this selection to the Mastertab.
Continue doing 1-3 for other countries/sheets KNOWING that data should be pasted just below the previous one (so it has to find first blank row and paste data there).
Example:
First row with data for each country is 18. This is the place where first line with expense is posted. User will fill in only data in column K (all other columns are filled with formulas, vlookups, etc.)
Assuming that I have 3 expenses for France, I want Excel to select B18:P20 and paste into Mastersheet in cell B18.*
*Next pasting in Mastersheet should be from cell B21.
Hope it is clear. :)
Thank you in advance,
Marek
you would definitely be stretching the limitations of Excel formulas if you tried using formulas to do this.
You can use VBA to do this, but you're going to probably going to need the user to trigger the macro every time they make an entry. If you need the master to be dynamically updated then that's going to be harder again.
I think the cleanest way to do this is to have a macro that builds the master list from scratch every time you run the macro, i.e. deletes the Master sheet, and recreates it again. This way you don't have to deal with reorganizing the master output every time a new row is added. That would require a lot of additional logic.
If you are doing a multi-user environment with concurrent updates, then this approach will not work, as you would need an additional server to handle messaging between each user. At this point, you're better off not using Excel.
If each user will add their data, run the macro and send the sheet to the next user you could concoct a macro approach.
From a very high level:
Create a macro to co-ordinate all that comes below
Delete everything in your master (MasterSheetName.Cells.ClearContents will keep the formats if you need it)
Create an index which keeps track of the last row with data in your master sheet. This will start at 1
Iterate through each of the country sheets
https://support.microsoft.com/en-ie/help/142126/macro-to-loop-through-all-worksheets-in-a-workbook
Iterate through column K looking for values
Iterating through populated rows in Excel using VBA
In this example they are looking at column A. You can replace 1 in the sh.Cells(row,1) to sh.Cells(row,11)
Copy the data to the mastertab
Copy from one workbook and paste into another

how to optimize speed excel 2007 (±20,000 rows)

I'm in the process of working with an Excel file that contains two columns (old URL and new URL). But it contains about 20,000 rows.
And I have another file containing about 400 old/new URL that needs to be imported in the big ±20,000 rows file.
I have to do all kinds of processing, like:
- Find all duplicate rows (same two columns more than once...). That functionnality would be in a column and it would be good to run that function each time I add 1 row to check if that URL combination already exists in the file
Note that I already turned the sheet into a table.
2 questions now:
1) should I do some kind of vlookup from the ±20,000 rows sheet and the ±400 rows sheet, or VBA? I don't know what would be the best way to do this (i.e.: if that row from the ±400 rows sheet is not in the ±20,000 rows sheet, add it...). Should I use vlookups or populate arrays in VBA (speed-wise)? If I use vlookup, it is true that it is possible to put the vlookup function in a sheet and refer to it in every row instead of puting a vlookup function directly in every row?
2) How can I optimize the 20,000 rows sheet because now, each time I want to sort or filter, it takes an eternity to redraw and it freeze my PC for that time!
Thanks for you help.
Firstly to ommit the dupes from the 400ish row sheet that need to be added in, use a COUNTIFS formula against the big sheet, then sort by this value and only copy in things where there is < 1 for the value (or error).
Secondly I would probably do the same thing in the big sheet but referencing itself, anything with a value above 1 is a dupe.
Lastly, are there formulas in the 20,000 row sheet? I could set up a 20,000 row sheet with just a "1" in range A1:A20,000 and doing anything on it would be super quick. It all comes down to what data you have in there and what you can do to reduce it's load on the system (ie convert formulas to values if they no longer need to calculated)
Excel 2007 has a built-in feature and VBA you can use for your situation: Range.RemoveDuplicates or Data tab -> Data Tools group -> Remove Duplicates
For example data:
Click the Remove Duplicates button:
And you are done!
The VBA equivalent is:
ActiveSheet.Range("$A$1:$B$10").RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
Note the 1 & 2 does not mean Columns A & B. It means the Columns of the selected Range.
If your worksheet only contains 2 columns, you could use UsedRange instead.

Culminating numerous workbooks with dynamic arrays to one single workbook, excel

I will have a defined number of identical workbooks within excel for each member of staff, at present this is 3. I want to have a master workbook where I can consolidate the data from all 3 workbooks. If there was a defined number of inputs I could obviously just copy and paste the data over or use a macro to make it seem more 'live'. However, it will be unknown how many inputs each member of staff will have and the only way I could imagine doing it is by the following equation (however I would use the workbook reference):
=IF(Sheet1!A1<>"",Sheet1!A1,IF(Sheet2!A1<>"",Sheet2!A1,IF(Sheet3!A1<>"",Sheet3!A1,0)))
However, when you drag the formula down it will give the obvious problem of putting the value of Sheet2!B13 in the 13th cell if there were only 12 inputs in SheetA, I would need to know the final value of the first sheet to reference the second sheet - but they are dynamic.
Any help would be appreciated.
If you want to find the last row of an area by a formula in Excel;
You need Table:
Select your area.
Click on Formats as Table from Home→Styles, and select one of then
Now you have DESIGN tab that you can see the Table Name like Table1.
Now, you have a table and by this formula you can find number of rows of your table:
=ROWS(Table1)
And by this formula you can find number of columns of your table:
=COLUMNS(Table1)
And when you want to know its value try this (The final value):
=INDIRECT(T(ADDRESS(ROWS(Table1)+1; COLUMNS(Table1)))
NOTE : By using Tables you Don't need to specify your sheet.

Resources