NateO
Legend
- Joined
- Feb 17, 2002
- Messages
- 9,700
Hola Excel gurus, this is my first OP question on the board, how exciting. In any case here's the deal, I'm trying to sum o12:q12, and every 7th offest row of this range through row 222. Here's what I thought would do the trick:
=SUM(N(OFFSET(O11,(ROW(1:31)-1)*7+1,0,1,3)))
It's returning the correct range, and I believe I'm following the dereferencing *rules*. But it's not working, it's only giving me the first cell in the array, when I expect the full array. I've tried transposing this once and a few times, as the VB results of this array are odd, still no dice. Is the three column array bollixing this up or am I missing something obvious?
Thanks in advance.
Edit: {=SUM(TRANSPOSE(OFFSET(O11,(ROW(1:31)-1)*7+1,0,1,3)))} and
{=SUM(N((OFFSET(O11,(ROW(1:31)-1)*7+1,0,1,3))))}
Gives me all of cells in column O, but not the three columns...
Edit: Still interested obviously, but I'll use a udf in the interim which actually works:
<font face=Courier New><SPAN style="color:#00007F">Function</SPAN> foobar() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Currency</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> y <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN>, z <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, Cls <SPAN style="color:#00007F">As</SPAN> Range, ws <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
ws = Application.Caller.Parent.Index
y = [transpose(OFFSET(o11,(row(1:31)-1)*7+1,0,1,3))]
<SPAN style="color:#00007F">Set</SPAN> Cls = Sheets(ws).Range(y(1).Address)
<SPAN style="color:#00007F">For</SPAN> z = 2 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>
<SPAN style="color:#00007F">Set</SPAN> Cls = Union(Cls, Sheets(ws).Range(y(z).Address))
<SPAN style="color:#00007F">Next</SPAN>
foobar = Application.Sum(Cls)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>
With usage: =foobar()
I hate Excel.
=SUM(N(OFFSET(O11,(ROW(1:31)-1)*7+1,0,1,3)))
It's returning the correct range, and I believe I'm following the dereferencing *rules*. But it's not working, it's only giving me the first cell in the array, when I expect the full array. I've tried transposing this once and a few times, as the VB results of this array are odd, still no dice. Is the three column array bollixing this up or am I missing something obvious?
Thanks in advance.
Edit: {=SUM(TRANSPOSE(OFFSET(O11,(ROW(1:31)-1)*7+1,0,1,3)))} and
{=SUM(N((OFFSET(O11,(ROW(1:31)-1)*7+1,0,1,3))))}
Gives me all of cells in column O, but not the three columns...
Edit: Still interested obviously, but I'll use a udf in the interim which actually works:
<font face=Courier New><SPAN style="color:#00007F">Function</SPAN> foobar() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Currency</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> y <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN>, z <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, Cls <SPAN style="color:#00007F">As</SPAN> Range, ws <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
ws = Application.Caller.Parent.Index
y = [transpose(OFFSET(o11,(row(1:31)-1)*7+1,0,1,3))]
<SPAN style="color:#00007F">Set</SPAN> Cls = Sheets(ws).Range(y(1).Address)
<SPAN style="color:#00007F">For</SPAN> z = 2 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>

<SPAN style="color:#00007F">Set</SPAN> Cls = Union(Cls, Sheets(ws).Range(y(z).Address))
<SPAN style="color:#00007F">Next</SPAN>
foobar = Application.Sum(Cls)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>
With usage: =foobar()
I hate Excel.
