Increment cols in offset function in excel - excel-formula

I have a formula :
=OFFSET($C$10,FaultAnchor,1,7,1)
I want to increment cols when dragging to the left, what is the corrent code?

Assuming your rightmost cell is A10, your formula needs to look like this in A10:
=OFFSET($C$10,FaultAnchor,count(A10:$A$10),7,1).
When you drag it to the left, the count range will increase.
Not sure what "FaultAnchor" refers to though.

Related

How do we change column value and keep row constant in spreadsheet formula?

I have to calculate the value of cells A1 till A10 and it takes values from M21, N21, O21, and so on till V21.
How can I write a formula to calculate the same?.
I tried =M$21 to keep row 21 constant, but while dragging the formula down from A1 till A10, it doesn't change the column ref as it's dragging down.
How can I change the column reference to change while dragging the formula down from A1 till A10?.
I would index across the columns based on the current row:
=INDEX($M$21:$V$21,ROW())
use in google sheets:
=INDIRECT(ADDRESS(21, ROW(A13))
dragging this down will give you N21, O21, P21, etc.

Offset with sum Excel

I have a workbook with Columns A1:A9 - I1:I9 containing numbers. Column J1-J9 shows the values of A1-I1. What I would like to do is show the sum of A1:A9 in J1 and follow that method down. Here is my offset formula:
=OFFSET($A$1:1,0,ROW(A1)-1,1,1)
Is there a way to add a SUM to this?
Best I can understand, you want to sum A1:A9 in J1 and B1:B9 in J2 and so on...
If that is correct, put this in J1:
=SUM(INDEX($A$1:$I$9,0,ROW(A1)))
and drag down.
Note if there is no data below then one can use:
=SUM(INDEX(A:I,0,ROW(A1)))
Scott is correct, here is another way:
=SUM(INDIRECT(ADDRESS(1,ROW())):INDIRECT(ADDRESS(9,ROW())))
Copy and paste down the column.

Drag formula down and change the reference of the column (index+match)

I need help with the following formula:
=INDEX(Sheet2!A2:A11,MATCH(Sheet1!Q5,Sheet2!C2:C11,0)+0)
(this part needs to change column references: Sheet2!C2:C11,0)+0)
I need to change the column reference whenever I'm dragging it down. I tried this:
=INDEX(Sheet2!$A$2:$A$12,MATCH(Sheet1!Q4,OFFSET(Sheet2!$A$2:$A$12,0,ROW(O$4:O4)-1),0)+0)
but it always comes up with #N/A
I tried solution from other topics but couldn't find one that uses index and match.
PS. My formula starts from cell O5
Can you advise please?
Much obliged
In general, if you want to change the column reference when dragging down, use a combination of INDEX and ROW, e.g.
= INDEX($1:$1,ROW())
This will grab values further to the right in the first row as the formula is dragged down.
You can also modify this to have INDEX return a range (instead of just a single cell) to be used as part of another formula, e.g.
= INDEX($1:$5,0,ROW())
This returns a 5x1 array which shifts over to the right as the formula is dragged down. (The 0 in the above formula indicates to select all of the rows in the $1:$5 range.)
In your formula, you can try replacing this:
Sheet2!C2:C11
With this:
INDEX(Sheet2!$2:$11,0,ROW()+<offset>)
Where <offset> is the necessary offset that you need.
If your formula starts in O5 and you want that first formula to grab the C column, I imagine that <offset> should be -2. This is because ROW() of O5 is 5, but you want that cell to grab the 3rd column (so you need to subtract 2). Then when you drag down to O6, that part of the formula would evaluate to Sheet2!D2:D11, and in cell O7, it would evaluate to Sheet2!E2:E11, etc.
So your final formula should be:
= INDEX(Sheet2!A2:A11,MATCH(Sheet1!Q3,INDEX(Sheet2!$2:$11,0,ROW()-2),0)+0)

#VALUE! align cell position missing (excel)

I use this formula to align cells like here
I put this formula in E3 and then I press CTRL+SHIFT+ENTER
=INDEX($D$3:$D$6,MATCH("*" & MID(B3,SEARCH("http",B3),99),$D$3:$D$6,0))
The formula stops at the first step, but does not consider that the function that values do not align correctly, that is what I seek.
if I change position of cells of column D formula return me this error:
#VALUE!
Look this pic, please:
Is there any solution to correct position of cells of column E with column D after first formula alignment between B-D?
Note: alignment must following same LINK and It should value the same function as a loop. Loop because function must look at the alignment with the neighboring column, in our case is the D until e.g http://beta.com link is on the same row level. They could take more steps, but eventually you have to get to an array. P.S: each link of start column (B) is unique
Simply put in E3:
=IF(D3<>"",INDEX(D:D,MATCH("*"&MID(INDEX($B$3:$B$6,COUNTIF($D$3:$D3,"<>")),SEARCH("http://",INDEX($B$3:$B$6,COUNTIF($D$3:$D3,"<>"))),999),D:D,0)),"")
and copy down. this is NOT an array formula.
EDIT
If I got you right, then all you want is to flip over the original formula...
=IF(D3="","",INDEX(B:B,MATCH("*" & MID(D3,SEARCH("http://",D3),999),B:B,0)))

Making row ranges adjust

In my Excel spreadsheet, I've got a cell that is =SUM(C6:C19). If I go to C20 and add a row, that formula will not adjust. I want it to change to =SUM(C6:C20)
Rather than use a static range in the formula you can use a dynamic range:
=SUM(OFFSET(reference, rows, cols, height, [width]))
For example:
=SUM(OFFSET('My Sheet'!$C$6, 0, 0, COUNTA('My Sheet'!$C:$C)))
This assumes nothing else is in column C. You can restrict the height range if necessary*:
=SUM(OFFSET('My Sheet'!$C$6, 0, 0, COUNTA('My Sheet'!$C$6:$C$30)))
*From Lunatik's comment
The simplest way is to leave a one cell space between the bottom of your values and the sum formula.
For example, Cell A20 currently sums cells A1 to A19. in you insert a row below A19, the sum won't won't include the new row right?
Well, if you put the sum formula in cell A21 and sum from A1 to A20 (even though a20 hasn't got anything in it), when you insert a row above cell A20 your sum formula will include it.
The offset thing mentioned as an alternative answer is a great way to do it also, but is more confusing, this is what I do if I want to keep it simple.

Resources