View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default functions & range vars

If I understand you correctly -
[ cells(rw,1) represents each cell in column A]

Dim sm as Double, rw as Long

sm = 0

For rw = 1 to lastrow
If Cells(rw,1) = [ put in your condition ] then
sm = sm + Cells(rw,1)
Elseif '<<<< use for additonal conditions, add as many as needed...

Else

End If
Next

--
steveB

Remove "AYN" from email to respond
wrote in message
oups.com...
Greetings:
I'm trying to do something that should be easy but can't find a decent
book. I'm using Excell 2000 and want to create a custom sum function
that handles more than one conditional. Can't figure out how to get
range into the function and use it in the calcs.

Mysumif(RngOne as Range)

For i = first cell to last cell in range
If .... and ... Then sum this cell into total. (like that see?)
next i

then use it like any function:

Mysumif("A1:A50")

any suggestions?

Thanks,
Bob