Excel sum range & next set of range numbers - excel

Trying to do something which I think is quite easy but I cant figure it out.
I have a row of about 1000 items. I want to sum for items (A1:H1) and then (I1:Q1) and so on until I get to the end. When I try to do (A1:H1) and drag the formula button across it then gives me (B1:I1). Im trying to avoid this.
Thanks!

Slightly convoluted but the below should work for you. You will need to add in the names of your sheet instead of "Sheet1", it essentially works off of the column reference of the cell the formula is placed into, I had it starting in column A.
=SUM(INDIRECT("'Sheet1'!"&ADDRESS(1,(((COLUMN()-1)*8)+1))&":"&ADDRESS(1,(COLUMN()*8),1,1)))

Related

Indirect function in Excel - dragging down the column

I'm working on a workbook that will have a master list of tasks for a group, and then each person within that group would have a worksheet with their specific information. I'd like to make a few columns of information from those sub-worksheets populate back into the master list.
I think what I want to do is an indirect reference to the worksheet tab names. The following formula works for me:
(B2 in this is a column that references the worksheet name, and E2 is the cell from that worksheet that i want returned)
=INDIRECT(B2&"!E2")
so, for example, B2 might say "Sarah", in which case the formula returns the value from cell E2 on worksheet "Sarah", which is exactly what I'm wanting to happen.
The problem I'm running into is that when I drag this formula down to the next row, my cell reference to E2 stays the same rather than progressing to E3 like I would like it to.
I have 3000 rows that I'd like to do this for, so manually re-typing the row # isn't sounding like fun. Is there any way to make that automatically progress?
I'm pretty sure my issues are in those " marks, but I'm drawing a blank. Can anyone help?
I did some more digging, and came up with the following solution:
=INDIRECT($B2&"!"&CELL("address",E2))
it seems to work. It might not be the most elegant of solutions, but I'll take it!
Consider something like:
=INDIRECT($B$2 & "!E" & ROWS($1:2))
We want to "freeze" he B2 and propagate the cell reference.
Maybe it didn't work because the sheet name contains one or more spatials. This would then work with: =INDIRECT("'"&B2&"'!E2")

Returning all values with certain criteria

I need help with creating excel formula. I have a list of names in row 1 and list of values in row 2. I need a formula that would return all of the names from row 1 that has a certain value (lets call it "value1") in row 2. I know how to do that with VBA but I would rather avoid using macros if possible. I'm pretty sure it would be possible with array formulas but I'm not really good with it so I would appreciate a help.
Something like this:
=IFERROR(INDEX($1:$1,AGGREGATE(15,6,COLUMN($A$2:$D$2)/($A$2:$D$2="X"),ROW(1:1))),"")
As it is copied down the selection will change.

Easy One - reference to non-sequential cells

I'm sure this has been asked before, but I couldn't figure out the right search terms to get the answer I was seeking, so apologies...
I have one worksheet with regular but non-sequential data (i.e. values in A1, A11, A21...)
In another sheet, I want to be able to put in a formula to get the values from those cells, and have it be easily scalable so I can drag the formula down and continue to get every nth cell from Sheet1. It looks like OFFSET will work, but it's not that elegant. VBA seems like overkill...Is there a better way?
Thanks!
Either Offset like you said, or something like this would be on the other sheet in Row 1 and copied down (assuming the first sheet is called 'sheet1', or change to the actual name:
=INDIRECT(ADDRESS(ROW()*10-9,1,,,"sheet1"))
Offset would be even clearer:
=OFFSET(Sheet1!A1,((ROW())-1)*10-ROW()+1,0)

INDIRECT for a whole column on another sheet

Ive searched around for how to use the indirect command for a whole column (on another sheet) but with limited responses
Ive seen it has to be something like this
=SUMIF(Site!$A:$A,D11,indirect("Site!$F",Row($F))
The reason I want to use indirect is because the cells on that sheet are always changing (and columns are being delted / recreated automatically) - But the data I need will always end up in the same cell (But the formula automatically readjusts when you delete a col etc)
Any help would be awesome
You mean you just always want to sum column F in your example? You can just use:
=SUMIF(Site!$A:$A,D11,INDIRECT("Site!$F:$F")
If that's so.

Excel 2010 VBA Autofill entire column

I am having trouble getting VBA to do the equivalent of Autofilling an entire row (such as when you double click on the plus sign of a cell with a formula and it autofills the appropriate number of columns).
Along Column A I have a list of dates. Along Row 3 I have a list of formulas. How do I write a macro which will effectively do this:
For i = 2 to Columns.Count
'FillDown the whole of Column i with the formula in Cells(3,i)
Next i
I want the fill down, not just a copy of the exact formula... Does anyone know how this can be done? I've got a method which is taking about 20 minutes so far but when I do this process manually it takes not very much time at all, so I think there must be a much faster way.
Thanks very much in advance for your help!
You can try to use Autofill with a destination range.
Something like:
Selection.AutoFill Destination:=Range("A2:A12")
[EDIT] Or:
Range("A1").AutoFill Destination:=Range(Cells(1, firstColNumber), Cells(1, lastColNumber))

Resources