Hi Art,
Try this UDF, enter as a single 2-column by n-rows array formula, where n is
the max number of >0 items.
it will be a lot faster than your array formula for a large number of rows:
on my system for 250 rows of data it takes 0.004 seconds as opposed to over
10 seconds for the array formula.
Option Explicit
Function ArtList(theFirst As Range, theSecond As Range) As Variant
Dim vFirst As Variant
Dim vSecond As Variant
Dim oRng As Range
Dim j As Long
Dim k As Long
Dim vArr() As Variant
Dim nRows As Long
'
' get the data, allowing for whole-column refs
'
Set oRng = Intersect(theFirst.Parent.UsedRange, theFirst)
vFirst = oRng.Value2
Set oRng = Intersect(theSecond.Parent.UsedRange, theSecond)
vSecond = oRng.Value2
'
' get number of rows in the array formula
'
nRows = Application.Caller.Rows.Count
'
' setup result array
'
ReDim vArr(1 To nRows, 1 To 2)
'
' look for numeric>0 in First
'
k = 0
For j = 1 To UBound(vFirst)
If IsNumeric(vFirst(j, 1)) Then
If vFirst(j, 1) > 0 Then
k = k + 1
If k > UBound(vArr) Then Exit For
vArr(k, 1) = vFirst(j, 1)
vArr(k, 2) = vSecond(j, 1)
End If
End If
Next j
'
' output the result as a 2-column n Row array
'
ArtList = vArr
End Function
regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com
"art" <(E-Mail Removed)> wrote in message
news:30025831-9C7E-42A9-AED9-(E-Mail Removed)...
> Hello all:
>
> I have the following formula to extract data from a long list. The list
> has
> two columns, the first one with amounts, the second one with items. I use
> this Array formula to give me in a list onlt the items that have an amount
> next to it. I sense that this array is causing my workbook to work slow.
> I am thinking now that maybe a custom funtion might work faster. Please
> let
> me know if I am right. And if I am right, how to convert this formula to a
> vba code.
>
> =IF(ROWS(Sheet1!$1:1)<=COUNTIF(First,">0"),INDEX(First,SMALL(IF((ISNUMBER(First)*(First>0)),ROW(First)-ROW(Sheet1!A$1)+1),ROWS(Sheet1!$1:1)))&"
>
> "&INDEX(Second,SMALL(IF((ISNUMBER(First)*(First>0)),ROW(First)-ROW(Sheet1!A$1)+1),ROWS(Sheet1!$1:1))),"")
>
> "First" is a name range for the column with the amounts.
> "Second" is the second column with the items in it.
>
> Thanks
>