Find and "copy" a range to a new sheet - excel

I have data that comes in into a sheet in certain time intervals, but every time the order might be different. So now, I want to "copy" the values from the "unsorted" sheet, to a new sheet which is sorted in the order I would like the data to be. From here on, calculations can be done using fixed references when referring to the "sorted" sheet.
Here is what I've done so far:
Determine the location of the label of the needed subset of the data in the unsorted sheet.
Determine where the actual needed data is on the sheet (the label is above the data, and one column to the right, so the data is one row down and one column to the left, and goes on for 32 columns and down 24 rows).
Now I want to do this step:
Use a array formula (CSE function) to reference those cells, as seen in this screenshot:
Trying to copy using CSE reference
Hitting Ctrl+Shift+Enter shows the result: #REF
What can I do differently?

Based on the feedback by #tigeravatar:
I referenced the range to the ASTIR sheet incorrectly:
in cell K13 is an invalid reference of "ASTIR!$A$5:ASTIR!$AF$29". You
don't need the sheet name twice, which is what's causing the #REF!
error.

Related

Excel Chart Sample Size

i have an excel file here someone else created which automatically changes the data size depending on the number entered into a cell. i cant for the life of me figure out how they have done it.. but i want to use something similar myself.
I will have a list from perhaps, A1 to A100, sometimes there are 50 entries, other times 20. So i want the chart to just show how many entries rather than flat lining the empty entries. (the empty data will automatically show 0).
This excel file i have, does that (see picture) but how can i do it also?
If the data in the column is a dynamic array, you can reference it with a spill range reference simply by A1#
Otherwise you can reference it by the formula A1:INDEX(A:A,MAX(NOT(ISBLANK(A:A))*ROW(A:A))). Note that this formula includes blank cells between the first and last non-empty cells.
Broken down, that formula is a reference from A1 to the last cell in the A:A column (INDEX(A:A,MAX(...*ROW(A:A))) that has a value in it: NOT(ISBLANK(A:A))

Auto update adjacent cells?

I have a table in excel which is constantly having new rows added. I then have another sheet (lets call it results) which is referencing this table, and counting the values in each column.
Every time I add a new record/row to my table, the results sheet throws a bunch of errors in every cell that references the column. Because I'm using a fixed range in the formula to count the column, e.g. =SUM(A1:A10), I then need to manually click each cell in results and select 'include adjacent cells' to get the count to reflect the new data. I have loads of cells in this table and I'm adding data daily so this is a very long winded way of doing things.
I'm looking for a way that I can automatically update these cells, either by using a macro, or adjusting the formula so that it will automatically increase the range of the SUM when I add new data.
The best solution I've had so far was to simply define the range to include the row below my last piece of data (i.e. if A10 is my last record, the formula would be =SUM(A1:A11)). This works, and auto increments the formula when a new cell is added. However, if I delete the record from the table for any reason, the formula reverts to only including the range containing data.
In other words, this solution works, but only until I have to delete a record. Is there any better solution that can detect which rows are populated, and auto include them in the formula?
=SUMPRODUCT(INDEX('Sheet1!'A:A,1):INDEX('Sheet1!'A:A,LOOKUP(2,1/('Sheet1!'A:A<>""),ROW('Sheet1!'A:A))))
Using INDEX and ROW reference, deleting cells won't result in broken cell references. LOOKUP is used to calculate the last non-empty cell in column A. This will auto update.
Using SUMPRODUCT instead of SUM makes it an array formula and does not require older Excel versions to enter the formula with ctrl+shift+enter (because of the LOOKUP function)
In Office 365 you could use: =SUM(FILTER('Sheet1!'A:A,'Sheet1!'A:A<>""))

How to make an INDIRECT formula but with adjusting ranges

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")<>"")

Am I understanding Excel references correctly?

I'm trying to program my Excel document to help me calculate weekly costs of products I buy, on a shifting database. So far I made three sheets within the document.
Sheet1 has input data
Sheet2 processes Sheet1 data values
Sheet3 spits out a weekly income.
I am able to reference the cells ='Sheet1'!C2 in Sheet2.
What I want to do is reference a static column (i.e. Sheet1 insert new column 'C', making old 'C' to 'D') without breaking my function.
I've tried ='Sheet1'!$C3' but the moment I shift the column in Sheet1, Sheet2 does not keep the function 'Sheet1'!$C3.
Instead it translates to 'Sheet1'!$D3
Of course I can simply just fix my Sheet2 reference cell each time (changing from 'Sheet1'!D3 to !C3) with a new column in Sheet1 but if I don't have to keep fixing the function that would be fantastic.
How do I keep my reference cell from changing referenced column?
(I don't need to use $D$3 because I have a vertical line of cells I need to read.)
You can reference the cell using R:C format so for ='Sheet1'!$C3 you can change it to ='Sheet1'!$3:3. The idea is you use the : to separate the columns and the rows. you then convert the column portion to its corresponding number value such as A=1, B=2 C=3...

Reference a variable value in another cell as part of formula

SHORT QUESTION
Ive got a formula =IF(ISBLANK(Q.1!C71),"",Q.1!C71) im trying to be able to set a control cell / variable so instead of C71 it would reference c*$B$1*, *$B$1* being my reference / control cell / variable in the same sheet as this formula, any ideas how to do this ?
LONG QUESTION
Ive got a spreadsheet that is regularly provided by a 3rd part with different data in it each time, although the column order of the data is always the same.
To get the data into my spreadsheet, i create another tab in the same workbook as their sheet and reference the data in their spreadsheet in a sheet i call import template sheet, i then from there copy and paste the import sheet into my spreadsheet, as all the columns match.
To reorder their columns in a non destructive way i use the following formula in my import template sheet, for instance if i wanted their column C, in my sheets column F i would place this in F1 and the pull the cell down so it does this for all rows :
=IF(ISBLANK(Q.1!C71),"",Q.1!C71) (the ifblank just helps sanitise the data by not throwing #ref if there is no data in the cell.)
The issue i have is that i have around 30 columns to re order and although the column structure is the same, there is sometimes some 'header' data (basically a text summary) at the top of the document of varying length, so instead of the first row i need being 71 sometimes it might be row 50 or row 90...
To speed things up id like to be able to have a control number / variable cell where i can set a variable for the starting row, and then reference that in my cell, so that i dont have the go and edit the formula in 30 different columns.
If you want to control the starting row of the reference by putting a number in cell B1, that would look something like this:
B1
71
Referencing Cell
=IF(ISBLANK(INDIRECT("Q.1!C"&B1),"",INDIRECT("Q.1!C"&B1))
INDIRECT allows you to build a string representation of a cell reference and then get the value of that cell. So we build a string reference using the value of B1, and then use INDIRECT to get the value of that string's referenced cell.

Resources