Insert a formula from another sheet based on same cell values - excel

I have a master workbook with two columns: names and formulas, which are specific for certain names. Generally, there are some 300 different names and 10 different formulas. What I need is to insert that formula in another sheet when some of this names appear - some kind of vlookup formula which won't give me value but formula.
And second part of a problem is how to make this formula (if it can be somehow inserted) dynamic and use relative values for calculation from same row in calculation sheet....

Please see my simulation below. My formula is F3 (ignored = sign) and its name is Name1. For test purpose, I typed 7 into cell F3 and 8 into cell F4.
With the formula below I typed in sheet2, I am able to call the formula of =F3 and change the reference given to cell F3 to F4 and reach to result of 8 in master sheet.
=INDIRECT("Master!"&SUBSTITUTE(VLOOKUP("Name1",Master!$I$3:$J$10,2,FALSE),"3","4"))
Maybe you can solve your puzzle by using functions I used in above simulation (INDIRECT and SUBSTITUTE).

Related

Excel table auto-fills incorrect formula when inserting rows

I have an Excel 2019 Workbook in which I have a sheet with a range of cells defined as a table. Table columns are A to H, where columns A and C contains formulas and the others have to be manually compiled with information by users. The sheet is protected, with the cells in columns without formulas unlocked, so that users cannot alter formulas, but they are allowed to add rows (in the middle of the table, not at its end) as this can be required.
The problem is that when adding rows, the formula auto-filled in column A for the row below the new one is incorrect.
Detailed explanation
Column A is used to assign an unique number to what si written in column B, so that if an element in column B is repeated, the corresponding number in column A is repeated as well
The first cell of the table in column A (A4) contains the value "1"
Cell A5 contains the formula "=IF(B5=B4;A4;A4+1)"
Cell A6 contains the formula "=IF(B6=B5;A5;A5+1)", and so on
If I add a row between 5 and 6, the formula in the new cell A6 is correct, but the formula in cell A7 becomes "=IF(B7=B5;A5;A5+1)", instead of the correct "=IF(B7=B6;A6;A6+1)"
Formulas in all the cells below A7 are correct
If I manually fill the formula in A7 form another cell by using the fill handle, the formula corrects itself
I know there is a similar thread MS Excel Auto-Fills Incorrect Formula When Adding Rows and I already tried some workarounds described there such as clear the column and then add the formula back again, but without results.
My situation seems to be different because the formula is not present in the entire column because of the "1" in A4.
Even though the problem can be manually addressed with little effort via the fill handle, this is not a suitable solution since users may not correct the formula, which is needed for some other calculations in another sheet of the Workbook.
The behaviour you describe is normal and nothing to do with tables. If you insert a row in between a cell and another cell it references directly in a formula, that formula will not adjust to refer to the new cell. In other words if A6 contains =A5 and you insert a row between rows 5 and 6, that =A5 will not suddenly alter to be =A6.
If you need that behaviour, you would need to use something like INDEX or INDIRECT - for example:
=INDEX(A:A,ROW()-1)
will always refer to the cell in the row above the formula cell.

Adding the sum of best 5 of 7 cells

So I have tried to use sumproduct to pull data from cells. My issue is that I would prefer to pick 5 individual cells vs a bank of cells.
I can make this formula below work, but it pulls "Place" cell values into the equation as well as "Points" value cells
Image of cells and formula
I would like to use the formula
=SUMPRODUCT(Large(C5,G5,K5,O5,S5,W5,AA5,{1,2,3,4,5))
to pull only from the 7 specific cells, but I get an error. as soon as I enter large, it only has the first 3 cells highlighted.
The error states that You've entered too many arguments for this function.
I am new to the Large formula as well, but it can only accept an array, not individual cells. You did specify individual cells which would lead to the next argument.
Since the Large formula only excepts 2 arguments you have too many and it fails with an error.
It is not a nice solution, but I guess the formula could work if you put your specific individual cells in neighbouring cells to create the array needed for the formula. (Or at least refer to them in some other cells to create the Array)
For the result you also would need 5 cells to enter the Sumproduct formula to display in each cell the 5 individual results.
Similar to:
=SUMPRODUCT(Large(A1:A7,1))
Where A1:A7 would be the newly created array where you reference:
in Cell A1 =C5
in Cell A2 = G5
in Cell A3 = K5
etc.
The LARGE function expects a single contiguous range as its first argument.
This array formula should circumvent that restriction.
=SUM(LARGE(IF(MOD(COLUMN(C:AA), 4)=3, C5:AA5), ROW($1:$5)))

Auto +6 increment while dragging cells in excel

So, I got an excel with two sheets: Sheet1 and Sheet2, in which I transfer data from the first to the second using the formula: =IF(INT(+INDIRECT("Sheet1!A1"))< 42900,0,+INDIRECT("Sheet2!A1")) (the cells are custom format dd/mm/yyyy hh/mm/ss). In Sheet1, the cells are organized in groups made out of 6 columns (in this example, A being the first column within the group).
In Sheet2, when I drag the cell containing said formula to the cell on the right, the formula remains the same. I want so that when I drag the cell, A1 will become G1, basically incrementing the column "number" by 6 jumping to the next group of 6 columns.
Is there a way of doing this WITHOUT using any coding. I need to avoid coding at all costs in order to avoid further complications.
P.S. I apologize if my explanation and title are somewhat vague.
Enter below formula anywhere in Column 1 and drag/copy across (to right)
=IF(INT(INDIRECT("Sheet1!" & ADDRESS(1,FLOOR((COLUMN()-1)*6,1)+1)))< 42900,0,INDIRECT("Sheet1!" & ADDRESS(1,FLOOR((COLUMN()-1)*6,1)+1)))
This formula will refer to cells $A$1,$G$1,$M$1,$S$1,.....
If you have to use this formula in say Column B then change (COLUMN()-1) to (COLUMN()-2) and likewise for Column C,D,E,.... use (COLUMN()-3),(COLUMN()-4),(COLUMN()-5),.... respectively.

Excel offset where reference is to another worksheet

I am trying to create a series of formulas in Excel that use a reference on sheet 2, via a dependent cell on sheet 1 to display data from different rows on the sheet 2. I have searched here for some tips on this problem and discovered that using Offset is probably the solution, but I need some help on the last piece of the puzzle.
Basically, I need to be able to enter into A1 on Sheet1 the formula "=Sheet2!A1" and then, via an =offset formula have cell A2, A3, A4 etc on sheet 1 automatically display the contents of specified cells elsewhere on row 1 in Sheet2.
The reason for this is because sheet 2 is a large database and i'm trying to set-up sheet 1 as a summary sheet where users can display select information.
I can see how I could use the =Offset function in cell A2 on Sheet 1 to make this work if all the data was on one sheet, and how I could set the reference within the Offset formulas to =sheet2!A1, but what I want is for the reference to be A1 and for the offset to follow the target of A1 into sheet 2 and then locate the data there.
Can anyone help? Is this even possible? Am I going about this the right way? I can't use macros because the spreadsheet will be used by people who cannot have macros on their PCs
Thanks
I had this same question I'll share my solution.
Solution:
=OFFSET((INDIRECT(ADDRESS(1,1,,,"Sheet2")),ROW(),0,,)
References:
OFFSET(starting point, num of rows, num of col, [height], [width])
ADDRESS(row_num, col_num, [abs num],[a1],[sheet])
OFFSET can't take a reference from another sheet by itself. Neither will ADDRESS for some reason. In order to reference another sheet within a formula, you need to nest ADDRESS within INDIRECT like so:
INDIRECT(ADDRESS(1,1,,,"Sheet2"))
These two nested functions point to your Sheet1 cell A1. The first argument in OFFSET is your starting point, so you need to take the two nested functions and insert as the first argument to OFFSET like so:
=OFFSET((INDIRECT(ADDRESS(1,1,,,"Sheet2")),1,0,,)
Now you need to get that "1" to increment. The best way to do this is the ROW() function, which can return the row number of the current cell (for you, this is Sheet1 A1, returning a 1). Now we have:
=OFFSET((INDIRECT(ADDRESS(1,1,,,"Sheet2")),ROW(),0,,)
If you had started your formula in Sheet1 A5, instead of ROW(), you would need to insert (ROW()-4). Row 5 minus 4 equals 1. That's the part that I needed.
Hopefully this helps someone.

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