use ADDRESS function to define range in COLUMN - excel

I have to use
=COLUMN($L$1:$CA$1)
as part of my original formula that CA, is the last column for a table named MyTable.
Because the last column is always changing (add columns every month),
i want to use
=COLUMN($L$1:ADDRESS(1,COLUMNS(MyTable)))
but this is not work.
My question is: how can i add last column of a table to a part of specific range?

ADDRESS returns a string. But the range reference in COLUMN($L$1:...) needs a cell reference after the :. INDEX will return a cell reference.
So try within your formula:
...COLUMN($L$1:INDEX(MyTable,1,COLUMNS(MyTable)))...

Related

Sum of index matches for dynamic range of columns

On Sheet2 I am trying to sum the values in a row of a range on Sheet1 over a dynamic range of columns based on a lookup value for the from column and a fixed variable for how many columns to right of that lookup value for the to column.
I am using INDEX-MATCH to find the from cell based on certain reference, INDEX-MATCH with a reference added to the column lookup to find the to column, and CELL to get the position rather than value of the results.
What I have is the following:
=SUM(
CELL("address",
INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0)))
&":"&
CELL("address",
INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0)+'Control Panel'!$C$2)))
Control Panel!$C$2 is my variable for how many columns to the right of the from column I want the to column to be.
Obviously, this is not working. I suspect it's because the concatenated text in the SUM() reference the full file name rather than 'Sheet1'![from]:[to]. Not sure if this is the case, but also can't figure out how to get just the A1 cell position for the to.
Any ideas how I can get this to work?
Figured it out:
=SUM(INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0))):INDEX(Sheet1!$B$4:$BA$36,MATCH($A$1,Sheet1!$A$4:$A$36),MATCH(D$3,Sheet1!$B$3:$BA$3,0)+'Control Panel'!$C$2))
Literally just needed a colon between the two index-matches. Still not sure why this works, as the index-match should return a value.

Excel - How to use the OFFSET function where the reference is in one column but not in a static cell location?

So say I have data like this:
I want to find the date data highlighted in yellow using the value "Production" highlighted in green in the A column. However, the cell where location resides may change (the column does not change) as the table is updated from outside sources. How could I use the OFFSET function to get that date data? Or is there a better function to use?
The formula below assumes that your data don't extend outside the A1:AZ1000 range:
=INDEX(A1:AZ1000,MATCH("production",A1:A1000,0)+1,AGGREGATE(15,6,POWER(10,LOG10((B2:AZ2>0)*COLUMN(B2:AZ2))),1))
(the references to row 2 are because the data in your screenshot start on that row, so it identifies the first numeric column as the first column in B2:AZ2 containing a value > 0)
The assumption made is that you want the value from the 1st numeric column that is on the row below where production is found (as, if you simply wanted the last row of the first column of numeric data then the position of production would be irrelevant).
(if your version of Excel is earlier than 2021/Office 365 then the formula must be entered as an array formula)
=OFFSET(A1,MATCH("production",$A:$A,0),4,1,1)
Match finds the row of "production"
Offset uses the match as it's 2nd argument (rows) from A1, then over 4 columns and retrieve 1x1 cells.

Excel Index formula for 3 column lookup

I'm looking to look up 2 values on another worksheet and return a third column value in a cell.
It doesn't appear to like the bracket after Match containing the array.
=INDEX(Table9[#[Date of Last Review]], MATCH([#Name]&'Hot Water Safety'!G1, Table9[#Name]&Table9[#[Risk Assessment or Other Document Title]], 0))
I've also tried this without table referencing using the worksheet reference instead.

Set Range based on Cell Value

In the Index and Match functions, the columns are fixed (column C for the index range and Column F for the Match range). The starting row for both is on a seperate page "Input" Cell C7 and ending row for both is on the same "Input" page but Cell C10. The ranges are on a sheet "Constants". The formula is on a sheet "Summary". The starting and ending rows will change project to project and I need a way for these formulas to update based on the row values on the "Input" page.
I think the issue is that the ranges as calculated are returned with quotation marks at the beginning and end. When I hard code the current ranges, the quotation marks aren't there. I tried the Substitute function to replace the quotations with nothing but they remained. I also tried using the Address function, but it returned with quotation marks too. An example input for B2 in the formula is P102. Input!C7 = 1271, Input!C10 = 1400. So the code is trying to return the value in Column C on the constants page by matching the row 102 is in in Column F.
=IF(OR(RIGHT(B3,2)="01",RIGHT(B3,2)="64"),"REFERENCE",INDEX("Constants!C"&Input!$C$7&":"&Input!$C$10,MATCH(NUMBERVALUE(RIGHT(Summary!B3,3)),"Constants!F"&Input!$C$7&":"&"F"&Input!$C$10,0)))
Wrap your references in the INDIRECT function. From the documentation:
Use INDIRECT when you want to change the reference to a cell within a formula without changing the formula itself.
INDIRECT("Constants!C"&Input!$C$7&":C"&Input!$C$10)...
and
INDIRECT("Constants!F"&Input!$C$7&":F"&Input!$C$10)...

Use INDIRECT function on a Non Adjacent cell range

Okay, so I can very easily use Indirect on a cell that contains a range(entered as text) and then use INDIRECT to reference that range :
Like it's done here (see Answer):
Have one cell represent a cell range
*In the column C there's a drop down list for each '=INDIRECT()'
The range E2:E4 'returns' to the drop down list : Miami,Paris,Rome
The range E5,E2 SHOULD give: Amsterdam,Miami but it gives #REF
If you are putting each value in a separate column then you can use the following:
=IF(ISBLANK(A2),INDIRECT(B2),INDIRECT(A2)&","&INDIRECT(B2))
This will return your original indirect if the cell is blank and if not it will return both values. (I used column A but you can change the reference

Resources