lookup offset

white6174

Board Regular
Joined
May 6, 2002
Messages
137
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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,

The following worked for me. Please test and report your results

<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>
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top