View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default need help with a lookup and count and if statemnt

You need an UDF to do that:

Function specconc(header As Range, nums As Range)
Dim h As Range, n As Range
colcounter = 0
retvalue = ""
For Each n In nums
colcounter = colcounter + 1
If n 0 Then retvalue = retvalue & header.Item(1, colcounter) & " + "
Next n
If retvalue = "" Then
specconc = retvalue
Else
specconc = Left(retvalue, Len(retvalue) - 3)
End If
End Function

Usage:

Sub test()
x = specconc(Range("A1:J1"), Range("A2:J2"))
End Sub

Regards,
Stefi

€žDingerz€ť ezt Ă*rta:

Hi,

I have 2 rows and 12 columns. The first rows is the headers second is the
values.

Ld1 Ld2 Ld3 Ld4 Ld5 Ld6 Ld7 Ld8 Ld9 Ld10 ....
2 10 0 0 0 98 0 0 10 15
.....

it looks sumthing like this. I want a formula to go through the row and tell
me which colmns in row 2 have a number greater than 0 in this format :
Ld1 + Ld2 + Ld6 + Ld9 + Ld10

Any suggestions??