Indirect function in Excel - dragging down the column - excel-formula

I'm working on a workbook that will have a master list of tasks for a group, and then each person within that group would have a worksheet with their specific information. I'd like to make a few columns of information from those sub-worksheets populate back into the master list.
I think what I want to do is an indirect reference to the worksheet tab names. The following formula works for me:
(B2 in this is a column that references the worksheet name, and E2 is the cell from that worksheet that i want returned)
=INDIRECT(B2&"!E2")
so, for example, B2 might say "Sarah", in which case the formula returns the value from cell E2 on worksheet "Sarah", which is exactly what I'm wanting to happen.
The problem I'm running into is that when I drag this formula down to the next row, my cell reference to E2 stays the same rather than progressing to E3 like I would like it to.
I have 3000 rows that I'd like to do this for, so manually re-typing the row # isn't sounding like fun. Is there any way to make that automatically progress?
I'm pretty sure my issues are in those " marks, but I'm drawing a blank. Can anyone help?

I did some more digging, and came up with the following solution:
=INDIRECT($B2&"!"&CELL("address",E2))
it seems to work. It might not be the most elegant of solutions, but I'll take it!

Consider something like:
=INDIRECT($B$2 & "!E" & ROWS($1:2))
We want to "freeze" he B2 and propagate the cell reference.

Maybe it didn't work because the sheet name contains one or more spatials. This would then work with: =INDIRECT("'"&B2&"'!E2")

Related

How to reference every cell of another tab using indirect

I want to create a tab that will display all the cell values of another tab based on the tab name provided on a cell.
I have played around with the indirect function, but I cannot write a formula so that by dragging down and right it will access the cells.
=INDIRECT("'"&$A$1&"'!A1")
This part &$A$1& is getting the name of the tab.
If I drag down this formula, the last A1 does not change though.
You can use the formula ="Sheet2!A1" in Sheet1 Cell A1 and drag down, then across. I tried to find a faster way to paste it into every cell, but I had to force quit the application because it used all of my available memory. You might think about whether you actually need every cell to be duplicated into the second sheet. Good luck!
Edit: Just realized you were dead set on using Indirect. This should work.
=INDIRECT("'Sheet2'!"&CELL("address",A1))
Simply use following formula
=INDIRECT($A$1&"!A" & ROW(1:1))
Try building the string like this. The final A1 will work as you want it to.
=INDIRECT(CONCATENATE("'",$A$1,"'!", CELL("address",A1)))

Best function to get a cell from the same row as another cell on a separate sheet

What is the best function to get a cell from the same row as another cell on a separate sheet. On sheet 1, A2 is a lead id and B2 is a name. On sheet 2, if I put in the lead id on A2, I want the name to autopopulate in B2. The function I used is =IF(A2=Leads!A:A,Leads!B:B," ") Now, it works fine with my first two leads but then it returns the false value on all the others. It has worked a couple times but it seems really glitchy. Any better way to accomplish this?
I think you should be able to use a vlookup function for this. Try putting the following formula into Sheet2 cell B2:
=VLOOKUP(A2,Sheet1!A:B,2,FALSE)
vlookup will work (Chris Moore answered with this)
Personally I prefer using index/match because if you alter the structure of the sheet by inserting or removing columns the formula adapts better and also because index match can lookup columns in any order and uses more precise ranges
=INDEX(Sheet1!B:B,MATCH(Sheet2!A2,Sheet1!A:A,0))
For a more in-depth explanation there is one here: https://www.deskbright.com/excel/using-index-match/

How do I lock in a cell in a list into a formula, so that the formula won't lose it when I edit the list?

I have a list of employees with their stats, its the kind of job where people come and go. Now I'm good with data and the numbers make all the sense in the world to me. Management not so much. So I present the data in a separate worksheet in a much "nicer" way. I want to delete someone in the list in a way that if I refer to a cell in the "nicer" worksheet, B64 for example for lets say "sally" if i delete a row above it. Sally's data becomes "john" data and the other worksheet is messed up. How do I avoid that.
The solution is to use the indirect() function
If you want to cell reference A1 of sheet1 in nicer sheet, then usually we reference it us =+Sheet1!A1. But to avoid the #REF! problem on deletion use the indirect function as below
=INDIRECT("Sheet1!"&CELL("address",A1))
now even if you delete rows in sheet1, the nicer sheet will not get messed up; it will reference the cells correctly in the order how it is in sheet1 correctly in nicer sheet without any #REF!

Easy One - reference to non-sequential cells

I'm sure this has been asked before, but I couldn't figure out the right search terms to get the answer I was seeking, so apologies...
I have one worksheet with regular but non-sequential data (i.e. values in A1, A11, A21...)
In another sheet, I want to be able to put in a formula to get the values from those cells, and have it be easily scalable so I can drag the formula down and continue to get every nth cell from Sheet1. It looks like OFFSET will work, but it's not that elegant. VBA seems like overkill...Is there a better way?
Thanks!
Either Offset like you said, or something like this would be on the other sheet in Row 1 and copied down (assuming the first sheet is called 'sheet1', or change to the actual name:
=INDIRECT(ADDRESS(ROW()*10-9,1,,,"sheet1"))
Offset would be even clearer:
=OFFSET(Sheet1!A1,((ROW())-1)*10-ROW()+1,0)

How to look up information based off a single cell? In Excel

I've been working on VBA for so long I forgot how to do this...using formulas.
I have a cell that has a descriptor in it, in this case K1122121. The cell next to it, will be the description. On another sheet I have a list of parts, I need to look up said part number on sheet 2, and place the description next to the part it's looking up.
I know it's possible, I just forget how.
So to recap.
Sheet one has two cells, the first is a part number, the 2nd next to it, is where the formula is going, in this cell will produce the description to said part number.
Sheet two has part and description side by side. I need to reference the part number and find the description.
Once the description is found, place said description in the description field in sheet one.
Thanks for the help.
Here is a link of what I am working on. https://dl.dropbox.com/u/3327208/Excel/PAERTO.xlsm
It's called VLOOKUP and you call it like this:
=VLOOKUP(A1,Sheet2!A:B,2,FALSE)
Where:
A1 is the cell with the part number in sheet1
Sheet2 the sheet where the data is located (descriptor / description)
A:B is the range in sheet2 where the data is located
2 because what you are looking for is in the second column
FALSE to only get a value for exact matches - if no exact match is found, it will show an error
EDIT
Looking at your workbook, I would personally insert a new column in the jobs list (say between D and E) with a formula that only keeps the first word only - formula in E3:
=IF(ISERROR(FIND(" ",D3)),D3,LEFT(D3,FIND(" ",D3)-1))
Then the formula in the PAERTO sheet then becomes - formula in D20:
=VLOOKUP($E20,'Jobs List'!$E:$F,2,FALSE)
in the example you provided, I get a result for lines 20, 22 and 24, and an error on the other lines.
I can get a result if I use this formula:
=VLOOKUP(E20&" Rev"&F20,'Jobs List'!D:E,2,0)
However you need to change cell F20 to 4.
As long as part number and "Rev" are consistent between sheets, this formula should work.
Note that only cells D20 and D24 return values. The other part numbers don't exist on the other sheet, so regardless of what formula is used you will not see a return value.
With your part number in A1, in B1 the formula =VLOOKUP(A1,Sheet2!A:B,2,FALSE) will find the description
If you are on Excel 2003 or earlier, you will have to change Sheet2!A:B to be a full reference like Sheet2!A2:B2000
The answer was a little more complex than I was hoping, but I ended up using this as an answer. It may not be the most simplistic, or elegant, but it works.
=IF(E20=0,VLOOKUP("*"&E20&"*",'Jobs List'!D:E,2,FALSE),VLOOKUP("*"&E20&"*",'JL Archive'!D:E,2,FALSE))
I used the "*" to make it so that it utilized wild cards, something I never thought of using... but it works. I put the wildcard usage in front and behind so just in case any cells may have something more than the required text in the front of the part or behind it.
I hope this helps people. The original use for this was so I can use the formula can be used from another workbook, but as we all know this can be used anywhere. Enjoy :)

Resources