I have a file with 300 worksheets in which I need to insert a formula (INDEX/MATCH) in Column G of each worksheet. Each worksheet has a different end point, for example, Worksheet1 ends on row 30, Worksheet2 ends on row 600, Worksheet3 ends on row 44 etc.
The formula I enter will be on cell G2 across all 300 worksheets but each worksheet will have a different ending row. I want to enter the INDEX/MATCH formula on cell G2, but have it end at the last row for each tab. Trying to avoid dragging the formula down and then going to each tab to remove rows that are not needed.
Related
Scope: to hide rows containing cells with zero value and/or blanks and to unhide rows, once the same cells get populated (number, text; most of the cells contain formulas).
Required flexibility: to be able to apply hide/unhide to different specific ranges in a single sheet as well as to an entire sheet (no ranges' selection.)
General: Workbook consists of multiple sheets. Cells with zero values are placed in a column with the header, while blanks are in the same column but no headers.
About data sample, A1:C12, Sheet2, workbook “File R1”
Cells of concern are column C, C1:C12 (numbers and blanks.)
Row starting A1 – all blanks from A1:C1.
Row starting A2, A3, A4 – text in A2:A4, B2:C4 - blanks.
Row starting A5 – all blanks from A1:C1.
A6:C12 – table, alphanumerical data brought in by the functions.
A6:C6 – table header, text.
C9 and C12 contain cells = 0.
Scenario A: C7,C8,C10,C11 – numbers, hide rows corresponding to C9 and C12 because originally cells = 0. Unhide, if value in C9 and/or C12 > 0. Do not hide rows corresponding to blanks in C1:C5.
Scenario B: if in a column C of a table (C6:C12) all cells are equal to zero, then hide all rows corresponding to C1:C12.
As a cherry on top, it would be great to be able to run above scenarios simultaneously for more than one sheet in the same workbook. E.g., Sheet2 and Sheet3 contain identical data sets as described above.
I've come across few VBA solutions using codes. Is there a way to achieve "automation" of hide/unhide with the change in the cells' value outside VBA (and 365 Office subscription), please?
Excel file is meant for a group of users with a very basic skill set.
sub hide_unhide_rows()
Range("1:1").Rows.Hidden = True
Range("1:1").Rows.Hidden = False
Range("1:9").Rows.Hidden = True
Range("1:9").Rows.Hidden = False
End Sub
You hide rows containing cells with zero value or blanks and to unhide rows with value, you fill the blanks with value. Also see this answer and this answer.
Dim var1 As String
Sheets("Sheet1").Select
For LR1 = 1 To Range("A65536").End(xlUp).Row
Cells(LR1, 1).Select
If (ActiveCell.Value = "") Then
var1 = Replace(ActiveCell.Address, "$", "")
Range(var1).EntireRow.Hidden = True
End If
Next LR1
Hope it helps; please upvote.
So basically you are doing the following:
Search a value somewhere in a cell
Hide the whole row
In MS-Word, you have the possibility to use search and replace for applying specific formatting (like put all instances of a certain word into another font), however this feature seems not to exist in Excel, so VBA will be the way to go.
I need to copy over data from one worksheet to a master worksheet. I do this with a new created worksheet every week. The new worksheets I create every week use the same cell layout so I would need to use a formula that I can copy and paste on the master worksheet.
The values I need to return and sum are 1 row below the lookup_value that I would normally use in Vlookup; they are also 8 columns across.
lookup_value is in cell A138, Values to return and sum are in cells H139:P139.
These are the same cells every worksheet.
I've tried to use variances of Sum(Vlookup($H$139:$P$139,{8,9,10,11,12,13,14,15,16} & Index(Match but continue to get #REF! or #Value!
what formula structure can I use to lookup_value and return 1 row below and sum columns H - P?
Image 1 of "Master Worksheet" formula is located in cell I1996 under "Qty in Transit" This row is in reference to Part # A03781402 shown on the right.
Image 2 of "Worksheet 1" You can see where Part # A03781402 is referenced in cell A138. Now I just need to grab the Qty from Cells H139:P139, sum & return to "Master Worksheet" Cell I1996
Formula for 'Master Worksheet'!I1996 to sum 'Worksheet 1'!H:P one row below the row that matches 'Master Worksheet'!R1996 in 'Worksheet 1'!A:A.
=sum(index('Worksheet 1'!H:P, match(R1996, 'Worksheet 1'!A:A, 0)+1, 0))
The 0 as the column_num in INDEX is important; it means all columns within the indexed range.
You need to use something like a SUMIF:
=SUMIF($H$138:$P$138,$A$138,$H$139:$P$139)
If the lookup_value is in Z1 and the lookup_array ColumnA, then please try:
=SUM(INDEX(H:P,1+MATCH(Z1,A:A,0),))
I have an excel sheet, row1 contains columns in certain order,
i want to break this row at a specific cell contains chart[*], into multi rows.
image of the sheet,
or if there is a macro that count number of cells then copy them into new row will do the same job.
In cell A9 enter:
=IF(OFFSET($A$1,0,COLUMN()-1+6*(ROWS($1:1)-1))="","",OFFSET($A$1,0,COLUMN()-1+6*(ROWS($1:1)-1)))
and then copy both across and downward.
Macro newbie here....
I am trying to paste certain cells within a range from one worksheet to another based on the contents of cells in a particular row. For instance, within range B5:B100, I want to copy and paste the B cells to another worksheet -- and their companion row cells in columns J and M -- when the B cell of the row in question is non-blank. And instead of having blank columns in the worksheet2, I need the results to paste neatly into columns A,B,C).
For example, let's say there are only two non-blank cells in the worksheet1 range B5:B100 - cells B26 and B78. Running the range macro would then copy B26, J26, M26 and B78, J78, and M78 then paste them into the second worksheet starting at A2 (to allow for header row) and without blank rows (so B26 to A2, J26 to B2, M26 to C2 and B78 to A3, J78 to B3, and M78 to C3).
I was able to do a non-blank copy and paste of jsut the b column values but lost as to picking up the other needed cells for each row.
Thanks!
I would suggest:
Find the item using Cells.Find
When you find the item, you can get the row/column of the cell. Then on the new sheet, using a cell reference, you can say something like
Sheet2.Cells(curRow,"A").Value = Sheet1.Cells(foundCellRow,B).Value
For the adjacent columns, you can say
Sheet2.Cells(curRow,"B").Value = Sheet1.Cells(foundCellRow,"J").Value
I hope this helps
I am trying to get a row of cell to populate from one sheet in the same workbook to another. I have sheet1 and sheet2. They are text fields. I did the formula =sheet1!A2. It works, but I get a 0 if there is not data in the copied cell (sheet1, A2). How can I get the zero to be null.
=if(sheet1!A2="","",sheet1!A2)
This should evaluate the cell contents and keep blank cells as blank cells. I assume you want cells with the number 0 in them to stay 0.