How not to print a part of a an Excel table? - excel

I have a worksheet where user selects some rows from a table and prints it. I want to print everything that is blurred on the image plus the first column of the table (in orange).
Only the rows that have value 1 in the 2nd column, i.e. the selected rows.
Everything is fine tuned to fit on one A4 page.
How can I achieve to print only certain parts of the table?
Before you suggest Print Area, I tried that, selected everything apart from the 2nd column of the table and suddenly the whole print structure collapses and something that is supposed to take one page is now spread over 4 pages.

Related

In excel, how can I automate a sheet to be filled based on conditions of another sheet?

Is there a way in excel to copy the contents of one column to another sheet based on particular values in another column.
I have data which looks like this:
Sheet1:
Sheet2:
I would like to copy the column A of sheet 1 directly onto column A of sheet 2, but only if the value in column B is Y.
I have tried used the match function but am not sure how the best way to do this would be. Is there a way for me to achieve this?
My desired output is:
As discussed in the comments, #Waldorf99 was looking to have a second worksheet that would automatically show a filtered list from the first sheet. I can think of a few ways to do this (array formulas or pivot tables come to mind). The problem with mixing dynamic columns with static values is that the static values would become desynced from the dynamic ones.
In the original example, rows may have a blank value in the condition column in sheet one, and then may be assigned a Y or N at a later date. If a Y is assigned to a row in the middle of other rows, the filtered sheet would shift the existing rows down to make room. The static values would stay where they were, and would become desynced. To demonstrate:
If the above image is the original state of sheet 1 and 2...
...adding a y next to x.1.c would result in sheet two shifting columns A and B of row 2 down, but leaves columns C and D behind (as they are static, and not tied into the first two columns in any way).
One thing that may work as you are wanting are filters. You would only have one sheet, with all of the data manually entered. Then you can add filters, and change them to hide rows temporarily when needed.
To add and use filters:
Start with your data all on one sheet...
Highlight your data...
On the Home tab, select "Format as Table" and choose any style...
This turns your data into a table. You can filter by clicking the drop down in a given columns header row, then deselecting the values you want to hide.
The results are a table that only shows the rows with a 'Y'.
The other rows aren't removed, just hidden. You can always reset or change your filters, to configure which rows are visible.
Note: when working with tables, they will auto expand to account for new rows, so long as you work in the row directly under the table (e.g. don't leave blank rows). You can also manually resize the table at any time by clicking and dragging from the bottom right corner of the table.
There are tons of resources of Excel tables online, and it's a pretty useful tool in Excel.
Hope that achieves what you were looking for.

Return all matches in columns using one criterion (from drop down on another sheet)

I am having two tables, one table (table 1) below is main data, separated into many columns and blocks per 10 rows in one, as you can see A2:A11, A12:A21 and so on (many rows and columns) ... In Column A are unique numbers, but one number per block as a unique, and all other information in other columns can differ, sometimes will be more data sometimes not. The data is always same structured.
What I am looking is to have report / printable sheet where I will have all my columns on one sheet, but in a Column A2 for instance drop down list that will use all unique numbers from main data table and populate all matches on report page, same as it is on picture below. There are many columns that should work automatically when I choose something from "Number" drop down. The trick here is, there must be 10 rows per block also, I have organized it as it should be, but I can't figure out how to populate using functions. So, you can imagine clicking one drop down and getting those lists updated without scrolling endlessly through columns and rows on main data table...
Where I have a problem is that I am getting matches only for first rows but not whole rows (or all rows where matches are) ...
using this function:
=INDEX(Table1[Datum];SMALL(IF(Table1[Nummer]=Printable!$A$2;ROW(Table1[Nummer])-ROW(INDEX(Table1[Nummer];1;1))+1);1))
If someone can help me out, I would be happy!
Try below formula. After putting formula to cell drag down and across as needed. I have tested this formula in Excel2013 and with range (not as table). So, you have to adjust formula for table. I suggest you to first test the formula in single sheet like my screenshot and if it is successful then go for table in Report sheet.
=INDEX(INDEX(B:B,MATCH($G$2,$A:$A,0)):INDEX(B:B,MATCH($G$2,$A:$A,0)+9),ROW(1:1))

Restructuring data in excel

I am trying to condense data in a specific way. I want any occurrences of the number 1 in each column to show up as 1 (regardless of how many times it occurs) with the corresponding site, in the corresponding column. Some sites occur multiple times in the original data, and I want to make it so that only one of each unique site shows up in the resulting data table with a 1 for the corresponding column if there any 1's in the column from the original data.
I would think it would be a vlookup function, but I have tried many different things and I am really stuck on this.
Image of original data and what I am trying to do:
Thank you
This assumes that your data set only contains 1 or blank and this approach uses a Pivot Table with MAX function. Below are details in case anyone doesn't know Pivot Tables.
Select a cell in your data and insert Pivot Table. Note, I added a title for column A, as you need that in the Pivot Table.
Click in the created Pivot Table and the PivotTable Fields dialog should pop up. If not, right click in Pivot Table and select Show Field List.
Drag the Field names (Code, a, b,& c) down to the appropriate blocks below. (Values under Columns will be created for you.)
Click on the drop down arrow next to each field name and select Max. That will rename it to "Max of ...". If that bothers you, then you can type the name you want into the Custom Name field. Note, it will not let you type the same name as the field name, eg a, but it will work if you put a space in front of it.
Given that the Pivot Table would be a lot of work for a large number of columns, here is a formula based approach. Put this formula in cell G2, then drag it down and across to fill your new table.
Note, you will have to populate all codes that you have in column F. And if any new codes are added later you will have to keep this updated. One of the advantages of a Pivot Table is that it will do this for you.
I know that you won't be putting this in these cells, so adjust accordingly. In fact, I would recommend this be in another sheet.
=IF(COUNTIFS($A:$A,$F2,B:B,1)>0,1,0)
COUNTIFS($A:$A,$F2,B:B,1)
This will count each occurrence when the value in column A matches your code $F2 AND the value in column B equals 1.
If that count is >0, then you know that at least one match was found and the IF will return 1, otherwise 0.

How to Make An Excel Graph Without Hardcoding the Data Range

I have a graph getting data from a simple 2-row date and production amt. associated with that specific date. However, we are constantly adding more and more rows to this and I would like the graph to be self-updating every time we add more rows instead of having to change the formula's data range every single time we update the sheet.
Right now the formula we're using for the graphs is:
=SERIES(,'PRODUCTION SITE A'!$A$4:$A$125,'PRODUCTION SITE A'!$B$4:$B$125,1). Here's an example spreadsheet on Google Sheets to make it more visible what exactly I'm doing.
You can graph and chart dynamic ranges by putting the data in a Formatted Table. Highlight everything from [Date - Amt Produced] down to the last row of data (not including Total), and click "Format As Table".
Now, when you add lines to the data, the Table will expand - as will the graph! If it does not automatically expand, you can manually expand the table (and thus the graph) by simply clicking inside the Table, then clicking "Resize Table" in the Table Tools>Design tab.
Notably, if there is a blank line directly below the Table, entering data there will cause the Table to automatically expand its size to include the new data. If you have a Total row directly below the Table, you may have to "Insert" a row above the Total row, then enter data. My suggestion would be to move the Total somewhere else (perhaps above the Table?), so that you can simply type in the next blank line below the Table and have the Table adjust its size for you without the Total getting in the way.

Excel table not expanding when new data is added

I have an Excel spreadsheet which contains four data tables on the same tab. The final 3 columns in each contain formulae.
I then have a vba code which performs an sql look up within an SQL Server table and returns a set number of columns to update each of the four tables.
For three of these tables, the data is pasted in and the table automatically expands and the formulae is copied to the end of the table.
However, for the first table, the data is pasted in but the table does not expand and hence, the formulae does not get added to the rows outside of the table.
I have searched high and low for a fix but no joy. I have searched the data extraction VBA code with no luck (the code is an exact match) and no joy in the table properties. I have also checked the Options menu for Auto Format As You Type settings but all seems fine.
Does anyone have any ideas for me?
Thanks,
David.
Hi All again,
Would love to know if anyone has an answer for this but, in the mean time I have fudged the code to automatically adjust the size of the table based on the row number for the last cell of data.
Thanks,
David.
I ran into the same issue and it was driving me nuts. Found out that in a few columns I had dragged formulas down pretty far (they were IF statements to return nothing if the first column was empty) so I didn't see them.
So remove any formulas that are 'under' the last row of the table. Should clear up the issue.
The most common cause is due to differing number of, or mis-aligned columns (vertically stacked tables) or differing number of, or mis-aligned rows (horizontally stacked tables).
For simplicity, let us use vertically stacked tables to illustrate what is happening. Consider an upper table with 2 columns and a lower table with 3. If we try to insert a row to the upper table, XL attempts to push all cells beneath the table down, but ONLY the cells directly beneath the table. So in this case cells below the 2 columns will be pushed down. XL quickly realizes that if it pushes just 2 columns down, the third column in the lower table won't be pushed down resulting in skewing the lower table. XL makes no attempt to figure out how to move the lower tables. It just refuses to even try.
The same holds true for adding columns to tables on the left for which there are tables directly to the right. If adding columns to a table would result in skewing rows of a table to the right, XL refuses to help.
To keep this from being a problem we can do a few things:
Keep the largest tables on top and to the left and align all table first columns and first rows.
If only rows are added to tables, don't stack them vertically
And if only columns are added to tables, don't stack them horizontally.
Herewith is an example of enforcing expansion of a table after data was copied over to the bottom of the table. This is done by resizing the table. Originally the table wasn't auto-resized as it has additional calculation columns.
The first line of the code finds the last row of data and the second line states the range to which the table needs to be resized. The third line resizes the table to the new range.
Replace sXXX and tXXX with your sheet name and table name.
Sub ResizeTableXXX()
myLastrowOfData = sXXX.Range("A1000000").End(xlUp).Row
myNewRangeSize = "$A$5:$P$" & myLastrowOfData
sXXX.ListObjects("tXXX").Resize Range(myNewRangeSize)
End Sub
HIH

Resources