# lookup offset

#### white6174

##### Board Regular
Heres what I want to do, I have a filtered list (that is generated with an array formula) in column A. Now in column C I want the same list but with some space's between(the number of space's is in column B, its figuired using a count if based on other criteria)

thanks steve w
Book1.htm
ABCD
4
51010A41010A
61020B3
71030B1
8
9
101020B
11
12
13
141030B
15
16
Sheet1

This message was edited by white6174 on 2002-09-20 14:45

### Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi,

<pre>Sub test()
Dim Rng1 As Range, Rng2 As Range
Dim UsedCell As Range, Counter As Long, i As Long
Dim MyArr1, MyArr2, MyArr3, MyArr4

Dim fn As WorksheetFunction
Set fn = Application.WorksheetFunction

With ActiveSheet

Set Rng1 = Intersect(.UsedRange, .Columns(1))
Set Rng2 = Rng1.Offset(0, 1)

For Each UsedCell In Rng1
If Not IsEmpty(UsedCell) Then
Counter = Counter + 1
If Counter = 1 Then
ReDim MyArr1(1 To Counter)
ReDim MyArr2(1 To Counter)
ReDim MyArr3(1 To Counter)
ReDim MyArr4(1 To Counter)
MyArr1(Counter) = UsedCell
MyArr2(Counter) = UsedCell.Offset(0, 1)
MyArr3(Counter) = UsedCell.Row
MyArr4(Counter) = 0
Else
ReDim Preserve MyArr1(1 To Counter)
ReDim Preserve MyArr2(1 To Counter)
ReDim Preserve MyArr3(1 To Counter)
ReDim Preserve MyArr4(1 To Counter)
MyArr1(Counter) = UsedCell
MyArr4(Counter) = fn.Sum(MyArr2) ' note the placement of this

MyArr2(Counter) = UsedCell.Offset(0, 1)
MyArr3(Counter) = UsedCell.Row

End If
End If
Next UsedCell

For i = 1 To Counter
.Cells(MyArr3(i) + MyArr4(i), 3) = MyArr1(i)
Next i

End With

End Sub</pre>

thanks steve w

never mind got it to work by opening it in frontpage and got it to work.

thanks alot just what I needed(I new it needed more columns, I thought it needed offset but I haven't used them much)

thanks again

steve w
This message was edited by white6174 on 2002-09-20 17:51

Replies
3
Views
157
Replies
5
Views
531
Replies
3
Views
191
Replies
2
Views
1K
Replies
2
Views
104

1,219,807
Messages
6,150,350
Members
450,952
Latest member
Zung

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back