Getting sheet name dynamically with fixed indirect cell reference - excel

I have created an Excel file named Sales consisting of the sheets: Settings, Country A, Country B.
In the sheet Settings I have the following values:
A B C
1
2 $B$1
3
4 Country A
5 Country B
6
In the cells A4 and A5 I have the following formulas:
A4 = MID(CELL("filename",'Country A'!$B$1),FIND("]",CELL("filename",'Country A'!$B$1))+1,255)
A5 = MID(CELL("filename",'Country B'!$B$1),FIND("]",CELL("filename",'Country B'!$B$1))+1,255)
As you can see I use the formula as a dynamic reference to get the name of the other sheets into the sheet Settings.
All this works fine so far.
However, now I want to achieve that the part $B$1 within in the formula is used as an Indirect reference to the Cell $A$2 within in the sheet Settings. At the same time I want that the sheet name remains dynamically.
Therefore, the desired result is that the sheet name is automatically adjusted if the user changes the name of the sheet but in case the user delets columns, rows or cells the reference always remains at $B$1.
What do I need to change in my formula to make this work?

Related

Reference data from a range on one sheet to individual cells on another based on neighboring cell value (Excel 365)

Sheet 1 will be references to individuals based on unique identifiers, such that column A will be their name and column B will have the identifier.
Sheet 2 will be an imported list of all individuals in our data set, such that column A is their name and column B is the identifier.
The goal is to be able to fill cells in Sheet 1 Column A based off of values entered in Sheet 1 Column B, by referring to Sheet 2 Column B., i.e. if the column B values match between sheets, I want the neighboring value in Column A to be copied over.
I'm a novice at this, but I don't think CONCATENATE is what I'm looking for, so the closest I've gotten is:
=IF($B:$B=Sheet2!$B:$B,Sheet2!$A:$A)
which results in a SPILL error, because I think my formula is trying to display multiple reference cells of data in one destination cell, whereas a formula such as
=IF(B3=Sheet2!B3, Sheet2!A3)
returns expected results, but is too limited for my purposes, in that it would be potentially faster to just manually enter the data, at that rate.
Trying to simplify, I'll have a sheet that has say 100 people in it, with identifiers 1 through 100. If I punch in their identifier in a separate sheet, I'm looking for their name to be displayed in a neighboring cell, or at least to have their name returned in the same cell, i.e. I enter "90" in Sheet1A1 or Sheet1B1 and it gives me "John Doe" in A1, which is the value of Sheet2B90 that's associated with the number "90" that is in Sheet2A90.
So VLOOKUP does work with some wrangling, but XLOOKUP was the ultimate solution to what I needed. A formula such as
=XLOOKUP(A13,$A$1:$A$10,$B$1:$C$10,NONE)
Would return data from B1 through B10 and C1 through C10 to elsewhere in the sheet, in this case next to a lookup cell A13 into cells B13 and C13, if the value in A13 appears within the lookup array of A1 through A10. Locking the cells with $ allows the formula to be dragged down a range of lookup cells without Excel incrementing the values of the lookup or return arrays, just the value of the lookup cell.

I am using vlookup across 2 spreadsheets. The formula appears to be correct, but the value is not returning, only the formula displays

I am using 2 spreadsheets. Sheet1 -Return Codes needs the values from Sheet 2- GL Interfaces. I am trying to match with column 1 on sheet 1 to sheet 2 in order to bring back the correct Name associated with an application ID.
The formula displays in the cell instead of the value replacing the formula:
=VLOOKUP(A2,'GL Interfaces'!A2:F61,2,False). What is wrong with my formula for this simple lookup?
I click in the column where I want the value to return to.
Click Formula | select Vlookup.
Click on A2 (the column with the application numbers) on sheet 1
Go to second sheet and highlight array that I want to be searched.
Put in 2 as a column with the Names (col index num) that I want to be searched on the second sheet
Enter False for the last entry (Range_Lookup)
Enter and only the formal displays in the cell I want a Name to appear.
What am I doing wrong?
=VLOOKUP(A2, 'GL Interfaces'!A2:F61, 2, false)
is a valid formula. make sure that the first column of the 2nd argument of vlookup is the one that contains the value from the first argument of vlookup. in other words: A2 needs to be found in A column of sheet GL Interfaces and if there is a row with a match, then return value from B column of GL Interfaces sheet

Indirect Function in Excel

=Indirect("'App Summary'!"&$D$4&"18")
I have two worksheets, Sheet 1 and App Summary. On Sheet 1 in cell D4 I have a column lookup based on a value typed in cell B2. So for instance, if I type in July in cell B2 of Sheet 1, it will place H in cell D4 of Sheet 1. If I type in June in cell B2 of Sheet 1, then it will place G in cell D4 of Sheet 1. Using the above indirect formula, I look up a value in App Summary using the column reference in cell D4 on Sheet 1.
My question is the following. Is there a way to make the above formula dynamic so that if I add a row to the App Summary sheet it will automatically adjust the row in the formula? For instance in the above example lets say I am referencing H18 in the app summary sheet. If I add a row in the app summary sheet just before H18, how do I get the formula on sheet 1 =Indirect("'App Summary'!"&$D$4&"18") to update to =Indirect("'App Summary'!"&$D$4&"19") since the row it was referencing shifted down one?
Assuming from I am referencing H6 in another sheet , the other sheet is App Summary use
=INDIRECT("'App Summary'!"&D3&ROW('App Summary'!$A$6))
If you can be certain that any additional rows in App Summary will be added as right-click and Insert row, then you could reference the a cell in the last row with an absolute reference (using dollar signs to fix the reference).
Another approach would be to convert your App Summary to an Excel table (ctrl + t) and then use structured referencing. That way, you are not vulnerable to the changing structure of the App Summary sheet (except if you change column headings).

Indirect reference to sheet names

I have a several worksheets named Order 1, Order 2 etc. and a main sheet with the following table:
A B
1 Buying Price
2 Order 1 ='Order 1'!P2
3 Order 2 ='Order 2'!P2
ColumnA has the name of the relevant worksheet and ColumnB returns the value of P2 in that worksheet.
How do I modify the formula ='Order 1'!P2 so that the text is taken from the corresponding cell in ColumnA?
Tried a lot but every time I am getting incorrect formula error.
Try the INDIRECT formula:
=INDIRECT("'"&A2&"'"&"!$P$2")
A2 is the reference to the sheet name

How to import data from one sheet to another

I have two different work sheets in excel with the same headings in in all the row 1 cells(a1 = id, b1 = name, c1 = price). My question is, is there a way to import data(like the name) from 1 worksheet to the other where the "id" is the same in both worksheets.
eg.
sheet 1 sheet2
ID Name Price ID Name Price
xyz Bag 20 abc 15
abc jacket 15 xyz 20
So is there a way to add the "Name" in sheet 1 the "Name" in sheet 2 where the "ID" in sheet 1 = "ID" in sheet 2?
Without coping and pasting of course
Thanks
VLookup
You can do it with a simple VLOOKUP formula. I've put the data in the same sheet, but you can also reference a different worksheet. For the price column just change the last value from 2 to 3, as you are referencing the third column of the matrix "A2:C4".
External Reference
To reference a cell of the same Workbook use the following pattern:
<Sheetname>!<Cell>
Example:
Table1!A1
To reference a cell of a different Workbook use this pattern:
[<Workbook_name>]<Sheetname>!<Cell>
Example:
[MyWorkbook]Table1!A1
Saw this thread while looking for something else and I know it is super old, but I wanted to add my 2 cents.
NEVER USE VLOOKUP. It's one of the worst performing formulas in excel. Use index match instead. It even works without sorting data, unless you have a -1 or 1 in the end of the match formula (explained more below)
Here is a link with the appropriate formulas.
The Sheet 2 formula would be this: =IF(A2="","",INDEX(Sheet1!B:B,MATCH($A2,Sheet1!$A:$A,0)))
IF(A2="","", means if A2 is blank, return a blank value
INDEX(Sheet1!B:B, is saying INDEX B:B where B:B is the data you want to return. IE the name column.
Match(A2, is saying to Match A2 which is the ID you want to return the Name for.
Sheet1!A:A, is saying you want to match A2 to the ID column in the previous sheet
,0)) is specifying you want an exact value. 0 means return an exact match to A2, -1 means return smallest value greater than or equal to A2, 1 means return the largest value that is less than or equal to A2. Keep in mind -1 and 1 have to be sorted.
More information on the Index/Match formula
Other fun facts: $ means absolute in a formula. So if you specify $B$1 when filling a formula down or over keeps that same value. If you over $B1, the B remains the same across the formula, but if you fill down, the 1 increases with the row count. Likewise, if you used B$1, filling to the right will increment the B, but keep the reference of row 1.
I also included the use of indirect in the second section. What indirect does is allow you to use the text of another cell in a formula. Since I created a named range sheet1!A:A = ID, sheet1!B:B = Name, and sheet1!C:C=Price, I can use the column name to have the exact same formula, but it uses the column heading to change the search criteria.
Good luck! Hope this helps.

Resources