In Excel 2007 I use the following formula to refer to cells in other worksheets in the same workbook:
=INDIRECT($B$2&"!A9")
B2 contains the name of the worksheet containing the target cells (I want to turn this into a template, so I don't enter the name into the formula). The formula works, but I want to use this same formula over multiple rows (A10, A11, A12 [...] A1000). I am using this same code over multiple rows but with different fields (B9, C9 and so on), with a variety of different content types (data, number, text).
An alternate version of the formula is as follows:
='Worksheetname'!A9
But again, this requires hard-coding the name of the worksheet, which is not desirable for me.
Because of the sheer volume of the rows manual editing is not an option: is there any way to alter this formula so I can easily use it over multiple rows? Preferably without the use of VBA, but that is not a requirement.
If your records are located in the same cells in both worksheets, then you can use something like following:
=INDIRECT($B$2&"!"&ADDRESS(ROW();COLUMN()))
IF now, then you can easily offset them using given ADDRESS function
P.S. Please be aware with INDIRECT function that it slows down calculation performance on your workbook (few functions are OK, but if you have 10,000 of them then you might see some delay)
If you want to use the same formulas for several columns as well you could include something like this:
=INDIRECT("'"&$B$2&"'!"&ADDRESS(MATCH($B4;INDIRECT(CONCATENATE ($B$2;"!";"B:B"));0);MATCH(B$3;INDIRECT(CONCATENATE($D$2;"!";"A3:AR3"));0)))
B2=reference to sheet name
B4=first row for your data
B3=Column header
For those who want to pull all the same column of data from multiple sheet that have the same layout (and have each cell linked), it took me hours to work it out, but actually can be solved with a relatively simple way:
=OFFSET(INDIRECT("'"&G$2&"'!l7"),$A6,0,1,1)
The Indirect part take you to the right sheet and right cell, G2, H2 ... has the Sheet names (be mindful of sheet name with space, you will need to use ' ', which is the case for my workbook), and L7 cell of that sheet, and I want L8, L9, ----L200 all being pulled through;
Offset help you navigate the range of rows, A6 is an additional numbering row I added to move to the right row in each sheet.
Hope it help!
Related
I'm hoping someone can help me make better use of the INDIRECT formula.
I have a list of sheet names in a table and an INDIRECT formula that uses that list to return a value in a specified cell - the list of sheet names is just an easier way for me to drag the formula down the table and read the appropriate cells without having to manually link each sheet.
=INDIRECT("'"&A2&"'!"&"K10")
This works fine for single cells as the range ref is simply stated as the text in the formula (K10), the problem arises when I need to start referring to a range such as K10:K15 and summing the values.
The range K10:K15 will inevitably have new rows added or deleted on the relative tab and as INDIRECT is using text as the reference it means the range doesn't automatically adjust - this is as I understand it one of the 'benefits' of INDIRECT but in this case is actually holding me back.
Also worth noting that the range (K10:K15) may move as rows are added/deleted above this, as this range is part of a larger table.
In simplistic terms I want to achieve the same result as a standard reference to a range on another sheet, e.g. =sum(sheet1!K10:K15) (as this will adjust when rows are added/deleted) but I just want to be able to dictate which sheet is referred to via a list I have in a table on a summary sheet.
How do I either write INDIRECT so the range adjusts when new rows are added/deleted or is there a different formula I should be using that achieves this?
Any advice greatly appreciated :)
=INDIRECT("'"&A2&"'!K"& MATCH(TRUE,INDIRECT("'"&A2&"'!K:K")<>"",0)&":K"&MAX((INDIRECT("'"&A2&"'!K:K")<>"")*(ROW(INDIRECT("'"&A2&"'!K:K")))))
This indirectly references the rows from the first non empty cell up to the last non empty cell in given sheet in column K. Not sure if you need to enter with ctrl + shift + enter (not in the app version).
Note: If the range contains empty cells in between the first and last non empty cell it will be included as value 0
Or in office 365 use the following:
=FILTER(INDIRECT("'"&A2&"'!K:K"),INDIRECT("'"&A2&"'!K:K")<>"")
I have an excel datasheet with a column of 30 cells (A1:A30) that fills up automatically and randomly, so that some of the cells contain data and some don't.
I need to create a new list in the next column (b1:b30) containing only the data and no duplicates, but once the cells are filled I can't touch the datasheet so I can't use sorting, and sadly I work in an environment where macros aren't enabled so no VBA.
So far this is what I've come up with:
B1=IF(A1=0,IF(A2=0,...,IF(A29=0,A30,A29),A28),A27),...A2),A1)
And then
B2=IF(A1=OR(0,B1),IF(A2=OR(0,B1),...
And so on until by B30 I get an expression so horrifying it literally have me a nightmare.
It's there an easier way?
Thanks in advance
If you have access to the new Dynamic Array formulas UNIQUE and FILTER:
=UNIQUE(FILTER(A1:A30,A1:A30<>""))
Put that in B1 and Excel will spill down the list.
If one does not have access to those formula then put this in B1 and copy down:
=IFERROR(INDEX(A:A,AGGREGATE(15,7,ROW($A$1:$A$30)/(ROW($A$1:$A$30)=MATCH($A$1:$A$30,A:A,0)),ROW(A1))),"")
I have looked for this answer but haven't found anything that has worked so I apologize if this is a duplicate question.
I am using Excel 2010 and have two sheets within one workbook. The first sheet holds the majority of information regarding individual members and is where I am using the formula. The second sheet holds data regarding each members' usage. Each line represents one individual. I am trying to gather all of the instances for one individual listed in sheet two and place it in a cell in sheet one.
I have used the sumif function which works perfectly for the first individual I use it on. After that, dragging the box changes both the range and sum_range of the formula along with the criteria. I want the criteria to change to the cell in the next row but I need the range and the sum_range to remain the same for every cell. If I copy the formula from the first cell and paste it into the second row, nothing changes.
Any ideas as to how I can make the sumif formula work over the entire column without changing the range and sum_range? Or is there an easier way to do this? Please keep in mind, the second sheet will expand over time to include more and more instances which will need to be included in future calculations.
Lets say your range is A1:A3 so to completely lock it just change it into $A$1:$A$3.
Here is a screenshot of my data:
I want to search B4:B40 and C4:C40 and find all cells that are blank for both specified ranges. If blank in both ranges, return the text in the corresponding row in column A. Ideally, the output could be combined and it could list something like 8:00-2:00.
here is what i have so far:
=INDEX('C:\Path\to\other\worksheet\[Blank Schedule Grid.xlsx]Susan'!B4:B40, MATCH("",'C:\Path\to\other\worksheet\[Blank Schedule Grid.xlsx]Susan'!B4:B40,0),'C:\Path\to\other\worksheet\[Blank Schedule Grid.xlsx]Susan'!B2)
Am I on the right path?
The formula you want is:
=IFERROR(INDEX($A$18:$A$40,AGGREGATE(15,6,(ROW($A$18:$A$40)-ROW($A$18)+1)/(($B$18:$B$40="")*($C$18:$C$40="")),ROW(1:1))),"")
I will let you put in the workbook and sheet references. They are only needed on the Ranges. Do not put them on the Range references in the the ROW() functions. They are only there to return a number and it does not matter the sheet to which they reference. Just make sure that the ranges themselves match.
The concatenation with the workbook references would make the formula long and unwieldy. To do that VBA would be the best route.
Edit:
Got bored and decide to put in your workbook and worksheet references:
=IFERROR(INDEX('C:\Path\to\other\worksheet\[Blank Schedule Grid.xlsx]Susan'!$A$4:$A$40,AGGREGATE(15,6,(ROW($A$4:$A$40)-ROW($A$4)+1)/(('C:\Path\to\other\worksheet\[Blank Schedule Grid.xlsx]Susan'!$B$4:$B$40="")*('C:\Path\to\other\worksheet\[Blank Schedule Grid.xlsx]Susan'!$C$4:$C$40="")),ROW(1:1))),"")
Do you want all the values in a single cell or in a new column?
=IF(AND(ISBLANK(B18), ISBLANK(C18)), A18, "")
Assuming your data starts in A18 (as per the screenshot), you can put this in cell D18 and copy all the way down.
I am pretty new to excel and finding it a little tricky so any help would be appreciated!
I have a master sheet where data is going to be input by people. From this master sheet I have used IF statements to copy relevant columns to another sheet in the workbook. (not sure if thats the best way).
So when a new data row is input into the master sheet, this creates a new row in the other sheet because its displaying what has been input in the master. This is building up a sub-table so to speak. From this sub data (whether turned to a table or not) I want to create pivot tables.
Issues:
If the sub data is turned into a table, when new data is input in the master sheet the sub-table does not expand.
Trying it another way, without creating a table with the sub data I tried to create a dynamic range using OFFSET. However when an entry is deleted from the master sheet this creates a blank row in the dynamic range that is being used to create the pivot table.
Any help would be much appreciated! I've looked into OFFSET, MATCH, VLOOKUP and it's a little confusing although I do get the gist of what these functions can achieve.
Thanks in advance!
This particular combo is used to fiddle around with ranges, for example validations and complex lookups.
They will not help you with your issue.
The range expansion is triggered when new data is entered into an adjacent cell, not when its existing condition becomes recognizable.
The =OFFSET() is used to fiddle around with ranges.
The MATCH(...,0) finds the first match of your string, in your case the lack of string.
If you could in fact set up a Pivot table to indirect references this formula would be your solution:
=OFFSET(YourSheet!$A$1,0,0,MATCH("",YourSheet!$A:$A,0)-1,MATCH("",YourSheet!$1:$1,0)-1)
where A1 of YourSheet contains somthing like
=IF(IncrementalDataSheet!A1<>"",IncrementalDataSheet!A1,"")
I think I understand the problem you're having. If you have data in A:Z in Sheet1 and you only want to see columns A, T, and Y for example on your more visually appealing Sheet2, then the initial thought would be to put =Sheet1!A1 into A1 on Sheet2, =Sheet1!T1 into B1, and =Sheet1!Y1 into C1. Copy the range down as far as needed to display the data from Sheet1 and Bingo! A nice tidy summarized version.
But wait... If you delete a row from Sheet1, the referenced cell in Sheet2 now just displays #REF!... boo... that's no good.
So, instead of using direct cell references, you can make use of the INDIRECT function to make sure the values produced are always relative based on the address of the target cell.
In Sheet2 you would put:
A1 =INDIRECT("Sheet1!"&(CELL("address",A1)))
B1 =INDIRECT("Sheet1!"&(CELL("address",T1)))
C1 =INDIRECT("Sheet1!"&(CELL("address",Y1)))
And copy down. At first glance it looks just like the original result, the difference is you can now delete rows from Sheet1 without hurting the output on Sheet2 because the indirect references will just look up new values from where everything shifted.
You should then be able to pivot off of the result dataset pretty easily.
That said... when you make a pivot table you pick which columns you include, so you could just pivot off of the original giant table and exclude any columns that you're not interested in summarizing.