Excel drag copy and paste but change sheet name - excel

I have a Excel doc with a master log sheet that I would like to link to cells in other detailed sheets. The main sheet is called RFI Log and the other sheets are RFI001, RFI002, RFI003, etc.. Ideally on the RFI Log sheet in the Status column the formula would be =RFI_001!$A$18 and that would show the Status of RFI001. It works great. But I have over 50 RFI Sheets with a dozen fields that I want on RFI Log. Without having to type in the formula in each cell on RFI Log is there a faster way to replicate the formulas? I have tried all my cell locking tips ($) but when I drag a corner of a cell to pull down the formula the sheet name doesn't change incrementally. For example if I drag the cell =RFI_001!$A$18 the next cell turns into =RFI_001!$A$19 and not =RFI_002!$A$18.

Something like =INDIRECT"RFI_"&TEXT(SEQUENCE(18),"000")&"!A"&18-SEQUENCE(18))

INDIRECT should help you here. Usage: =INDIRECT(cellWithSheetName&"!A18")
You don't need the $ to fix column or row when dragging the formula. Just create a range of your sheet names and let the sheet name reference be adjusted when you drag the formula.

Related

If a cell in column A in sheet 2 equal to a value from sheet 1 then return the values from sheet 2 to column B and c in sheet 1

I am looking to do a kind of automatic cell updates on excel, which is a status update for a product we got and the location of the product in the warehouse.
I have basic knowledge of VBA and I didn't manage to code anything to help me with that. I tried to use If function, but didn't make sense because I can't find a way to achieve what I need.
Here is sheet 1
and sheet 2
examples.
This is what I am trying to achieve:
if a cell within Sheet2 column A range = Cell A2 in sheet 1, then fill Sheet1, B2 cell and Sheet1, C2 cell with the information from sheet2 on the condition that it is the most recent entry (in the example images it is the entry with the dispatched status)
Would you recommend VBA or using formulas, and if so what should I do?
This can be done with formulas, however getting the latest value isn't as easy as it seems. This can be achieved however by following this tutorial for reference. I especially refer to the part using LOOKUP(.
Other than that, all you need to do is set your ranges to refer to the correct sheet.
=IFNA(LOOKUP(2,1/(Sheet2!A:A=Sheet1!A2),Sheet2!B:B),"")
My formula in B2 is:
=INDEX(Sheet2!$B:$B;MAX(SI(Sheet2!$A:$A=Sheet1!A2;ROW(Sheet2!$A:$A)-MIN(ROW(Sheet2!$A:$A))+1)))
My formula in C2 IS:
=INDEX(Sheet2!$C:$C;MAX(SI(Sheet2!$A:$A=Sheet1!A2;ROW(Sheet2!$A:$A)-MIN(ROW(Sheet2!$A:$A))+1)))
Both formulas are array formulas so instead of entering them with ENTER, they must be entered pressing
ENTER+CTRL+SHIFT at same time
Anyways, these formulas will probably make your file heavy and slower. Think about redesigning the way you save data, and consider adding a date field, and resuming data with Pivot Tables.

Referencing cells to specify sheet range

My workbook contains a summary sheet which summarises the data held in the other sheets. My current formula in the summary sheet in cell C6 adds up cell B7 in all of the other sheets, RKW3455 being the first sheet to include in the calculation and Batch_20 bring the last sheet to include.
=SUM('RKW3455:Batch_20'!B7)
It works fine but the tab names will change and so to avoid having to change the sheet name within the formula I wanted to put the first sheet name into J2 and the last sheet name into J3. Then I wanted to reference those cells in the formula which will just make it easier to amend when there are new sheets. I can't get it to work though. This is what I have:
=SUM(INDIRECT("'"&J2):INDIRECT(J3&"'"&"!")B7)
I've also tried
=SUM(INDIRECT("'"&J2):INDIRECT(J3&"'")!B7)
Can anyone correct where I'm going wrong please?
Thanks
Used a workaround as suggested by Jeeped and Darren Bartrup-Cook in the comments. Created a 'start' sheet and an 'end' sheet to sum the sheets in between.

How to create an offset formula to use the reference in a cell (the cell the formula points to), not the cell address the formula is in?

I thought this would be easy, but haven't figured it out on my own or found an existing answer online.
I have a worksheet set up to create charts from the contents of certain cells in a table. I'd like to be able to point one cell to a value in another worksheet and have all the related cell populate with the values using the formula in the one cell as an address reference.
For example, if I put the formula ='Source Data'!G19 in cell E3, I would like cell E4 below it to act like it has the formula ='Source Data'!G20 (one row below in the Source Data worksheet) and populate that value while cell F3 to the right would act like it had the formula ='Source Data'!H20 in it. So the new worksheet would just mirror the table of data from the Source Data worksheet for as many columns or rows as I need.
I'd tried to figure this out with offset, indirect, match and address functions, but have failed.
It is important to note that the formula needs to be able to identify the actual cell address, not just match the value from the formula because the same values show up multiple times in the Source Data worksheet.
Any help or direction is greatly appreciated.
Here's my approach:
I have a workbook with 2 spreadsheets Source Data and Results, on Source Data, I have the "Static" table that contains all my values from A1 to D12(This can be any number of cells, as long as you use an equal range in the Results sheet).
On Results, Cell A1 is reserved for the "guide" cell from Source Data, written in the following format: ''Source Data'!A1 (note the two single quotes at the begging). I chose to start at Cell B2 on the Results sheet, you can switch the formula however you like.
The desired result is achieved by using the following formula on B2:
=IF(CELL("contents",OFFSET(INDIRECT($A$1),ROW(B2)-2,COLUMN(B2)-2))<>0,CELL("contents",OFFSET(INDIRECT($A$1),ROW(B2)-2,COLUMN(B2)-2)),"")
then drag down and to the right the same number of maximum cells that exist on Source Data and the result will adjust accordingly.
I prepared a Google Sheets document with all of the information.

Can I use one formula for several sheets?

I have a workbook that currently have 20 sheets and it grows with about 3 sheets per day.
All sheets use the same formulas in columns H-L.
But sometimes I find errors in the formulas or need to ad a condition to it and then I need to update all sheets formulas with the same formula. And that is the problem.
Can I have the formula in one cell somewhere and in each column just reference to this formula so that if I change the formula in this cell it will change in all places?
In each sheet I need the formula to "fill down" about 2300 rows.
In sheet1
A1
=A1+B1
In sheet2
A1
='sheet1'!A1 // will calculate A1+B1
Anyone know of a way to do this?
If all sheets have the same structure, you can use a 3D selection to change a formula in the same cell on all sheets.
For example, if your workbook has sheets 1 to 10, select cell B1 in Sheet1, then hold down the Shift key and click Sheet10. Now all cells B1 in all sheets from Sheet1 to Sheet10 are selected, no matter what the sheet name is.
Enter a formula like =A1+A2 and hit Enter. Click any sheet and check the result. B1 will have that formula in each of the sheets.
Now go back to Sheet1, select B1, hold Shift and click Sheet10. Change the formula to =A1*A2 (multiply instead of add) and hit Enter. Copy the formula down.
Check the other sheets and see that the same formula has been applied and copied down on all other sheets.
With this technique, you can select the same cell in all sheets of the workbook and change the formula in all sheets with just one edit. Of course, it only works if all sheets in the selection have the same data structure.
Edit after comment: You could use the first sheet as the Formula Master sheet, and just need to remember that if you want to change a formula, you first have to use a 3D selection. Other than that, Excel does not offer formula replication in the way you describe. A reference to a cell will always return the cell's value, not its formula.
You could create a UDF (user defined function) in VBA for your goal:
Press Alt+F11, right click on your project in the project explorer and select Insert --> Module. Paste the code below:
Function ExecuteFormula(ByVal Target As Range)
On Error Resume Next
ExecuteFormula = Evaluate(Target.Formula)
End Function
Now you can use the ExecuteFormula() like every other function. If you want to enter the formula in your master sheet as a string "=A1+B1" just replace the 3rd line with:
ExecuteFormula = Evaluate(Target.Value)
I hope this helps.

Row Number In Formula Not Counting When I Drag

I have the formula below that I'm using to link to a certain sheet and cell in my workbook that contains a graph for each entry. On the sheet I link too, each graph is about 20 cells down from the previous one. I have over a 100 graphs now and it will grow in time so I was trying to use the HYPERLINK formula rather than the Hyperlink button for this. I thought I would be able to just insert the formula in the first row, paste it in the second row with an added 20 cells, highlight the two and drag it down but it will not count in increments of 20.
Is this even possible?
=HYPERLINK("#'Trends'!A25","Click To View Trend")
I'm thinking you will have to use some type of concatenation to get the behavior you are after. To do this, you may want to employ a "helper" column. For example, put the "numbers" you are after in column B -- below you will see that I incremented it by 5.
Now your HYPERLINK formula in cell A1 is written as:
=HYPERLINK("[Book1]Sheet2!A"& B1,"Click Me for Sheet2, Cell A"&B1)
(Assuming the workbook is called Book1. Now, I can drag that formula down and it will update "dynamically" to account for the changes in column B.

Resources