Indirect formula to increment cell the cell AND the column? - excel

I have a worksheet name in cell C11 which I am referencing in a formula with a =INDIRECT formula.
I have also added the =ROW formula so that it increments the row number when I drag it down my worksheet.
My formula looks like this: =INDIRECT("'"&$C$11&"'!C"&ROW(C12))
How can I modify it so it also increments the column when I drag it right?
I've tried to use the =column method, but I assume I am doing something wrong as I just get a reference error, can anybody assist?

Column() returns the Column number, so you may use the R1C1 variant of INDIRECT.
=INDIRECT("'"&$C$11&"'!R"&ROW(C12)&"C"&COLUMN(C12),FALSE)
Greetings
Axel

A bit long, but working. Assume A2 has the =Column(A1) formula for the whole row.
Isert into A3 and copy to the while row:
=IF(A2>26,CHAR(64+ROUNDDOWN((A2+1)/26,0))&CHAR(64+A2-26*ROUNDDOWN((A2+1)/26,0)),CHAR(64+A2-26*ROUNDDOWN((A2-1)/26,0)))
This works only for the one and two letter columns. You can expand if you need after ZZ column.

Related

Find the Last Cell Value of the 2nd Column Set for each 1st Column Cell in EXCEL

I have the following structured table in excel where 1000s of rows included.
I want to return the Last Cell Value of Column B for Each value in Column A.
For example:
For Cell A1 -> I want to return the Cell B5.
For Cell A6 -> I want to return the Cell B9.
I have tried with VLOOKUP, HLOOKUP, INDEX likewise so many formulas where I ended with more conflict situations. Can anyone please write down a Formula to give my requirement a life?
Array formula (Press Control + Shift + Enter while entering the formula) in cell C1 and copy it down.
=IF(A1="","",IFERROR(INDEX($A2:$B$20,MATCH(FALSE,ISBLANK($A2:$A$20),0)-1,2),LOOKUP(2,1/(B2:$B$20),B2:$B$20)))
if you don't mind using column C as a helper column you could use something like that:
If you won't use Array formula you can Use this solution:
like this image:
use column C as helper with this formula in first cell =OFFSET(A1;SUMPRODUCT(MAX(($A$1:$A1<>"")*(ROW($A$1:$A1))))-ROW(A1);0)
and use this formula in column D's first cell =IF(A1="";"";INDEX($B$1:$B$13;SUMPRODUCT(MAX((ROW($A$1:$A$13))*($C$1:$C$13=A1)))))
and copy fill-down to all cells.
Try this shorter, without helper column and non-array formula solution
In C1, formula copied down :
=IF(A1="","",INDEX(B1:B$9,MATCH(1,FREQUENCY(1,0+(A2:A$9<>"")),0)))

Excel: How to Copy Hlookup position down?

I have an Hlookup formula and was trying to copy it down but the position number doesn't change. I Would like to be able to copy it down to other cells and need the position to change by 1 for each cell.
Hlookup(A1,B1:D20,2,False)
When I copy the formula down , I need 2 to become 3. Any help is appreciated. Thanks!
The easiest why to do that is to have a column with the return position you want. So:
Hlookup(A1,B1:D20,zz1,False)
cell zz1 has: 2
cell zz2 has: 3
etc...
If you don't like that you can add 2 plus row() and maybe subtract to get where you want when you copy.
Perhaps add another column to refer to as this number? Then, have this column increment by one either by formula or using Excel to do it for you. Thus, if your formula was in cell A2:
// in cell
E1: 2
// in cell (and copied down)
E2: =E1+1
Then, in the cell you mentioned, the formula would become something like:
=hlookup(A1,B1:D20,E1,False)

Range row number reference from another cell in Excel

Edited: So I made the question more complicated. If I would like to do a 'what if ' analysis which requires to be able to refer the last row to sum from another cell to the sumif formula. How can I do that?
Just drop the row numbers from your formula and use the entire columns:
=SUMIF(A:A,">4",B:B)
The beauty is that SUMIF will disregard non-nmeric rows anyway.
To sum up and stop at a certiain row, you can use SUMIFS with ROW:
=SUMIFS(B:B,A:A,">4",C:C,"<" & D2)
Where D2 holds the row number using the formula =ROW(<CELL>), i.e: =ROW(A2) in cell C2:

Excel formula - Sum cells until blank cell

Further to my previous question, Im trying to get cell E20 (Total) to work similarly - sum all cells preceeding until the the formula itself (E20), again to avoid any cells being excluded as rows are added. So far i have:
=SUM(INDEX(E:E,ROW()+1):INDEX($E:$E,ROW() + IFERROR(MATCH(“TOTAL",INDEX(D:D,ROW()+1):$D1004001,0)-1,MATCH(“TOTAL”,INDEX(D:D,ROW()+1):$D1004001,0)-1)))
So far I am simply returning an error message.
I am trying to sum everything in column E until it reaches one cell above the word Total in column D, to avoid a circular reference. Any thoughts?
Screenshot of workbook
No volatile or array formulas needed:
In E2:
=IF(F2="",SUM(INDEX(F:F,ROW()+1):INDEX(F:F,MATCH(1E+99,F:F)))-SUM(INDEX(E:E,ROW()+1):INDEX(E:E,MATCH(1E+99,F:F))),"")
And copy down the Column. Then a simple sum formula at the bottom
E2:
=AGGREGATE(9,6,(OFFSET(F3,0,0,
AGGREGATE(15,6,ROW(F3:F999)/ISBLANK(F3:F999),1)-ROW(F3))))
Copy/Paste into E8 and E14. The formula for the Total is pretty simple:
E20:
=SUM(E$2:E19)
After entered as indicated, these formulas will auto-adjust when you insert or delete rows in between, because they use relative references.
There's probably better ways, but this will work. I In cell E2, =SUMIF(F1:F7,"<>""""",F1:F7) and similarly in cell E8, etc. The range intentionally includes blank lines above and below each block of data, to ensure that Excel will adjust for any lines that you insert or delete.
For E20 you can just use the same format, =SUMIF(E1:E19,"<>""""",E1:E19)

How to reference value in cell to the left within a formula

I have 2 sheets in my spreadsheet. Sheet2 pulls information from Sheet1. In sheet2, there are 2 columns. Column A has company names. Column B has a formula which searches for the company name of that row within sheet1, and sums the values from that row in sheet1.
I have been able to achieve this with the following formula.
=SUMPRODUCT((Sheet1!B:B=A1)*(Sheet1!F:F))
This works fine, however I have to manually type "A1" into the formula. For the other rows, I would have to write B1, C1, D1 etc.
I have searched for how to reference the cell to the left, and I found this formula...
=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())), 0, -1)
This seems to work as a standalone formula in a cell, but I cannot figure out how to incorporate this into the SUMPRODUCT formula. Anything I try gives errors. I need something like this.
=SUMPRODUCT((Sheet1!B:B=(=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())), 0, -1)))*(Sheet1!F:F))
As per pnuts' suggestion to make it an answer:
The answer is just to drag the formula around. Just make sure to fix (either use F4 or add dollar signs) your range if it is not an entire column or an entire row

Resources